Forum Discussion
Gary_Rudolph_31
Nimbostratus
Sep 16, 2005Rule Based Persistence & Fail Over
We have a rule where it routes to a specific member using a value parsed from a cookie (JSESSIONID). The problem is if the member fails the rule still routes the traffic to the failed member. Is there a way to have it not route to the failed member and instead fall back on the pool? Our assumption with the current rule is that in setting the node specifically the F5 is smart enough to detect if it's down or not and to not use it if it is.
Here's the rule:
when HTTP_REQUEST {
if {[HTTP::cookie exists "JSESSIONID"]} {
set jvmid [getfield [HTTP::cookie "JSESSIONID"] "." 2]
} else {
set jvmid [findstr [HTTP::uri] "jsessionid" 44 3]
}
set nodes $::admin
pool admin
if {$jvmid ne ""} {
set entry [findclass $jvmid $nodes]
if {$entry ne ""} {
node [getfield $entry " " 2]
}
}
}
The cookie is usually of the format:
Cookie: JSESSIONID=371C2D7A70BAA2F1BC38F4D5ABDFF8D2.a02
We have a class that maps a01, a02 to specific members.
Thanks, Gary
- Gary_Rudolph_31
Nimbostratus
FYI, the goal is to be completely stateless with no persistence as the persistence tables would become large with a 2 hour timeout on a commercial site. - unRuleY_95363Historic F5 AccountUnfortunately, that's the problem with using the node command. It does not have any knowledge of the status. This is one big reason we now recommend using the pool member command. This takes into account status of the pool member. So, use this command instead of the node command:
pool admin member [getfield $entry " " 2] [TCP::local_port]
when LB_FAILED { LB::reselect pool admin }
- Gary_Rudolph_31
Nimbostratus
If we add the reselect it works. - Gary_Rudolph_31
Nimbostratus
If the pool is dynamic by the URI, can we set the pool used for that request in HTTP_REQUEST and then just read it in LB_FAILED? - unRuleY_95363Historic F5 AccountThe problem with "Action on Service Down" is that it applies to existing connections (eg, reselect a new server for the existing connections). It does not apply to new connections that have failed to connect to a specific pool member.
- unRuleY_95363Historic F5 AccountYou don't even need to set it in a variable:
when LB_FAILED { LB::reselect pool [LB::server pool] }
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