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
6 Replies
- 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.
We've also tried:
pool admin member [getfield $entry " " 2]
Instead of:
node [getfield $entry " " 2] - 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]
You will also want to add a LB_FAILED event so you can issue the command "LB::reselect pool admin" which will then reselect a new member of the pool based on a load-balancing decision (instead of using the supplied member).when LB_FAILED { LB::reselect pool admin } - Gary_Rudolph_31
Nimbostratus
If we add the reselect it works.
when LB_FAILED {
LB::reselect pool admin
}
Can't this also be done through the admin on the "Action on Service Down" = Reselect?
We were told not to do this as it would take longer for a fail over to recover? - 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?
when HTTP_REQUEST {
...
set selectedPool admin
...
}
when LB_FAILED {
LB::reselect pool $selectedPool
} - 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.
BTW, setting that attribute should not effect failover at all. I'm not sure why you were told that... - unRuleY_95363Historic F5 AccountYou don't even need to set it in a variable:
when LB_FAILED { LB::reselect pool [LB::server pool] }
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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