Forum Discussion
James_Yang_9981
Altostratus
Mar 11, 2009how to use persist lookup command
in one case I need manually select node depends on the status of server in the persist table. if the node is down, LTM need reject the client connection that is already in the persist table instead of select a new pool member. if the node is recovered during the persist table timeout, LTM need following the persist table select the old server for the same client new connection. source ip address persist is used in this case.
I figured out a rules to accomplish this, but not sure how to use persist lookup command.
the rules is like below:
when CLIENT_ACCEPTED {
persist lookup source_addr [IP::remote_addr] [all_status]
if {LB::status $all_status:nodename} {
node $all_status:nodename
else {
reject
}
}
the question is how to extract the node name from LTM's persist table, from irules wiki, only found following:
persist lookup [all|node|port|pool] "all" or no specification returns a list containing the node, port and pool name.
Specifying any of the other return types will return the specified item only.
= | { [any virtual|service|pool] [pool ] }
the latter key specification is used to access persistence entries across virtuals, services, or pools.
- Deb_Allen_18Historic F5 AccountI think you can do what you need without an iRule using the "Action on Service Down" setting in the pool configuration. (You have to select "Advanced" from the Configuration dropdown to see it.)
- James_Yang_9981
Altostratus
I understand the behavior of "Action on Service Down" setting. - Deb_Allen_18Historic F5 AccountThere really is no way to queue a connection until a specific server becomes available, but to simply keep rejecting it until the persistence record times out, I suppose something like this might work:
when CLIENT_ACCEPTED { set pserver [persist lookup source_addr [IP::remote_addr]] if {($pserver ne "") && ([LB::status $pserver] ne "up")} { reject } }
- James_Yang_9981
Altostratus
good rule, before I'm going to do a testing, there are one more question about the persistence table : - Deb_Allen_18Historic F5 AccountNot sure, but I doubt the persistence timeout is updated unless the system is able to send traffic to the persistence target. Let us know if you see that it does update the timeout during your testing.
- Nat_Thirasuttakorn
Employee
how about using persist delete? - Deb_Allen_18Historic F5 AccountIf the goal is to allow the node to recover for the length of the persistence timeout before selecting a new target, the persistence record offers an easy check for that without having to do clock arithmetic.
- Deb_Allen_18Historic F5 AccountJust ran into an old email that mentioned the PERSIST_DOWN event, which I had forgotten about: Click here
when PERSIST_DOWN { reject }
- James_Yang_9981
Altostratus
good, the rule becomes more and more short. - hoolio
Cirrostratus
I was going to try using the PERSIST_DOWN event to trigger persistence off of a second token in the client request. But I found, as James described, that the persistence record is removed once the pool member is marked down. So how does the PERSIST_DOWN event ever get triggered?! Is it there just to handle the instant between a pool member being marked down and the persistence table entry being removed?
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