Forum Discussion
Robert_Landrito
Nimbostratus
Sep 30, 2009downing a member from LB_FAILED
Hi all,
I'm trying to write an iRule that will down a member in LB_FAILED. I figured this would be a good spot to do it, since LB_FAILED is reached if a selected member is unreachable or non-responsive.
However, it seems that I can't get information for the selected member. [LB::server pool] returns properly, but [LB::server addr] and [LB::server port] don't give me anything, and I therefore can't call LB::down with the appropriate arguments. Calling LB::down alone doesn't seem to do anything in this context either.
Anyone else able to accomplish this? LTM 9.4.5.
- L4L7_53191
Nimbostratus
I think this is because of the way LB_FAILED works (someone please jump in if I am wrong): it'll fire if the LTM can't select a pool member, or that member is down. So to me it's not a surprise that you can't down a member from this event. - hoolio
Cirrostratus
Hi Matt, - L4L7_53191
Nimbostratus
Ahhh yes very good points Aaron, thanks. Now I'm going to have to go off and research this one...so the last question is key: are there any members available? If so, we'll need to dig into this one a bit! - Robert_Landrito
Nimbostratus
Ok my apologies everyone. The problem is that I was doing the LB::detach before the LB::down. The detach will "unselect" any currently selected member. Makes sense. - L4L7_53191
Nimbostratus
Makes sense, thanks for the follow-up. Would you be willing to post your rule, by chance? - Robert_Landrito
Nimbostratus
It's just a basic failover iRule. The idea is to use a designated "failover pool" for a given pool. I know I could do this with priorities but I need to snat as the "failover pool" will be a vip on an LB at an alternate datacenter. In addition to adding the snat, I inject a header to try and prevent any crazy loops between LB's. If you have any suggestions or improvements, especially regarding efficiency, do share.when RULE_INIT { set ::remoteDCSnatPool "remote-dc-snat" } when CLIENT_ACCEPTED { set defaultPool [LB::server pool] set failoverPool "[LB::server pool]-failover" set failover 0 } when HTTP_REQUEST { if { [active_members $defaultPool] < 1 || $failover == 1 } { if { [HTTP::header exists lb_origin] } { log local0. "lb_origin detected, rejecting" reject } else { log local0. "Failing over to $failoverPool" set failover 1 HTTP::header insert "lb_origin" 1 snatpool $::remoteDCSnatPool pool $failoverPool } } } when LB_FAILED { if { $failover == 1 } { reject } LB::down LB::detach log local0. "reached LB_FAILED, [active_members $defaultPool] active members" if { [active_members $defaultPool] < 1 } { if { [HTTP::header exists lb_origin] } { log local0. "lb_origin detected, rejecting" reject } else { log local0. "Failing over to $failoverPool" set failover 1 HTTP::header insert "lb_origin" 1 snatpool $::remoteDCSnatPool LB::reselect pool $failoverPool } } else { LB::mode rr LB::reselect } }
- JRahm
Admin
iRules contest ends today, might wanna submit that one by 5pm pacific!
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