Forum Discussion
Rick_110395
Nimbostratus
Aug 08, 2011iRule behavior when pools are down
For example......in this iRule what would happen if a connection was initiated to "host1.domain.com", but srvpool1 is down. What would the iRule do with the connection?
when HTTP_REQUEST {
if { [HTTP::host] starts_with "host1" } {
pool srvpool1
} elseif { [HTTP::host] starts_with "host2" } {
pool srvpool2
} elseif { [HTTP::host] starts_with "host3" } {
pool srvpool3
} elseif { [HTTP::host] starts_with "host4" } {
pool srvpool4
} else {
pool default-pool
}
}
3 Replies
- hoolio
Cirrostratus
Hi Rick,
TMM would send a TCP reset as if the iRule wasn't there and the default pool was down. If you want to check the status of the pool before assigning it, you can use active_members. Or you could use the LB_FAILED event to handle this after a load balancing failure occurs.
http://devcentral.f5.com/wiki/iRules.active_members.ashx
http://devcentral.f5.com/wiki/iRules.lb_failed.ashx
You could also replace the if/elseif/else chain with a switch statement:
http://devcentral.f5.com/wiki/iRules.switch.ashx
Aaron - Muhammad_64435
Nimbostratus
hello,
You can handle this situation intelligently when this occurs.
There could be 2 scenarios when pool is "down":
1. All pool members are down [ health check failed ] or disabled manually or connection limit reaches - high demand
2. Pool is emtpy [ yes you can have an empty pool in LTM :) ]
In my opinion, your iRule will look like this:
when HTTP_REQUEST {
if { [HTTP::host] starts_with "host1" } {
check if all members are down or disable then send to virtual waiting room that may send you back for retry
if { [active_members srvpool1] == 0 } {
HTTP::redirect "http://sorry.domain.com/pleasewait.html?[HTTP::host][HTTP::uri]"
}
check if pool is empty, means maintenance is in progress
if { ![members srvpool1] } {
log local0. "Pool is empty" ;
HTTP::redirect "http://sorry.domain.com/maint.html"
}
if all good then just proceed to the pool
pool srvpool1
} elseif { [HTTP::host] starts_with "host2" } {
pool srvpool2
} elseif { [HTTP::host] starts_with "host3" } {
pool srvpool3
} elseif { [HTTP::host] starts_with "host4" } {
pool srvpool4
} else {
pool default-pool
}
}
Hope it helps. - Rick_110395
Nimbostratus
Thanks guys!
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects
