Forum Discussion
pwallace_110041
Oct 07, 2011Nimbostratus
lb_failed with lb mode rr does not seem to produce expeted results
I am trying to use the following rule to make sure that when a node is down that traffic immeadiately goes to another node. But when I reboot one node from a two node pool the second node starts throwing 404's until the node monitors (http & icmp) take the node out of the pool.
What have I missed in my logic or understanding here?
when CLIENT_ACCEPTED {
set retries 0
set max_retries 3
}
when LB_FAILED {
log local0. "lb failed: $retries"
if { ($retries < $max_retries) and ($retries < [active_members [LB::server pool]]) }{
LB::mode rr
LB::reselect
incr retries
} else {
HTTP::respond 504 content { reached max retries or all members of the pool failed } noserver Connection close
}
}
Regards,
Pippin
- Michael_YatesNimbostratusHi Pippin,
when HTTP_REQUEST { The HTTP_REQUEST Event here is just for testing... log local0. "Initial Server [LB::server name]" } when LB_FAILED { Check to see if there are any available members left after the failure. If less than 1 (Zero), redirect the Client to a Sorry Page. if { [active_members [LB::server pool]] < 1 } { HTTP::redirect "http://www.yahoo.com" } else { Drop current persistence and LB::reselect persist none LB::reselect } }
- nitassEmployeeBut when I reboot one node from a two node pool the second node starts throwing 404's until the node monitors (http & icmp) take the node out of the pool.since there is 404, i don't think LB_FAILED will be triggered at that time.
- nitassEmployeei did a bit test. hope it is helpful.
[root@iris:Active] config b virtual bar list virtual bar { snat automap pool foo destination 172.28.17.33:http ip protocol tcp persist mysource profiles { http {} tcp {} } } [root@iris:Active] config b profile mysource list profile persist mysource { defaults from source_addr mode source addr timeout indefinite } [root@iris:Active] config b pool foo list pool foo { monitor all http members { 10.10.70.200:http {} 209.85.175.104:http {} } } [root@iris:Active] config b persist show all PERSISTENT CONNECTIONS | Mode source addr Value 172.28.17.30 | virtual 172.28.17.33:http node 10.10.70.200:http age 4sec [root@iris:Active] config curl -I http://10.10.70.200/ HTTP/1.0 404 Not Found Server: BigIP Connection: Keep-Alive Content-Length: 0 [root@iris:Active] config b rule myrule list rule myrule { when HTTP_REQUEST { set retries 0 set request_headers [HTTP::request] } when HTTP_RESPONSE { if {[HTTP::status] eq 404} { incr retries LB::down HTTP::retry $request_headers } } } [root@iris:Active] config b virtual bar rule myrule [root@iris:Active] config curl -I http://172.28.17.33/ HTTP/1.1 200 OK Date: Sat, 08 Oct 2011 08:47:51 GMT Expires: -1 Cache-Control: private, max-age=0 Content-Type: text/html; charset=ISO-8859-1 Server: gws X-XSS-Protection: 1; mode=block Transfer-Encoding: chunked [root@iris:Active] config b persist show all PERSISTENT CONNECTIONS | Mode source addr Value 172.28.17.30 | virtual 172.28.17.33:http node 209.85.175.104:http age 4sec [root@iris:Active] config
- kman_52500NimbostratusThe problem is that even though the rule advances things to the next member, other instances of the same rule might be doing the same thing and things are advanced globally, not just for that rule.
when CLIENT_ACCEPTED { set retry count to 0 to start off set retries 0 } when LB_SELECTED { set initial value for server_addr set server_addr [LB::server addr] } when LB_FAILED { retry a limited number of times if { $retries < 3 }{ only count as a try if tried a member not previously known to be down if { [table lookup -notouch -subtable dont_try $server_addr] != 1 }{ incr retries } remember that this node failed table set -subtable dont_try $server_addr 1 10 20 set loop_tries 0 work around to bug where LB::server is not updated after LB::reselect set new_pick [LB::select] set server_addr [getfield $new_pick " " 4] keep looping until we get a server not in teh dont_try table, loop a maximum of 5 times if you have a small pool, you will likely hit the max loop tires quickly, with 2 nodes and 200 concurrent connections I saw 8 max while { ([table lookup -notouch -subtable dont_try $server_addr] == 1) and ($loop_tries < 10) }{ incr loop_tries set new_pick [LB::select] set server_addr [getfield $new_pick " " 4] debug logging to see what is happening in the loop log local0. "set addr to $server_addr: loop try: $loop_tries" } select the new server based on values determined above eval $new_pick LB::reselect } else { if all else fails, send a 504 error back to the client and log log local0. "504 virtual: [virtual name], retries: $retries, last_server: $server_addr" HTTP::respond 504 content { reached max retries or all members of the pool failed } noserver Connection close } }
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