Forum Discussion
Hank_Maurer_105
Nimbostratus
Jun 21, 2005Expression Persistence
I would like to use expression persistence or a rule to send traffic to a specific server in a pool. We have a wireless device application that will connect you up to a server in a pool behind a vip, and then put the ip address of that server in the uri. I was hoping to base the persistence off of that ip address in the uri. The pool has 8 servers in it. I am not sure how to do this? Can you please help me?
Thanks,
Hank
5 Replies
- Scott_Tennican_Historic F5 AccountThe simplest way to accomplish this is using the pool select attribute.
For example:pool webpool { select node(findstr(http_uri, "?", 1) + ":80") persist_timeout 60 member 10.4.4.3:http member 10.4.4.101:http } - Hank_Maurer_105
Nimbostratus
Thanks! - Scott_Tennican_Historic F5 AccountSorry to be confusing.
There are three different ways to solve your problem: a rule, a pool with a persist expression (universal persistence), a pool with a select expression. Because you have the IP address in the URI the select expression is the most efficient. However, I included a persist timeout for the persist expression in the my code example. This timeout is unnecessary because a select expression is not persistence and therefore does not create persistence sessions that need to be timed out. You can turn on one of the persistence modes at the same time as using a select expression but traffic would continue to be directed by the select expression.
Another important point, the third argument in the findstr function is the offset. Therefore, you need to use a 6 to jump over "bigip=":
node(findstr(http_uri, "bigip=", 6) + ":80")
Read the Reference Guide iRules section for more details. - Hank_Maurer_105
Nimbostratus
Gumby,
A while back I contacted you about using expression persistenance. The people I was researching us this for just now want to put this in place. I tried the following and got an error.
pool WIRELESSDEV-80 {
select node(findstr(http_uri, "bigip=", 6) + ":80")
member 163.231.95.94:http
member 163.231.102.154:http
}
Error331835 -- Rule string to tree failed. - syntax error at 'pool'
line 1:pool WIRELESSDEV-80 {
WIRELESSDEV-80 is the name of the pool, and the 2 memebers are the ip's of the boxes in the pool. I guess I am not sure what the error means, string to tree failed? I looked at the release notes in iRules, but it is not really helping. Can you tell me what is wrong with the rule, or the way I have it defined?
Thanks for you help,
Hank - Martin_MachacekHistoric F5 AccountHank,
if you are entering the pool from command line (i.e. using bigpipe) you
need to put single quotes around the expression in order to avoid interference with shell globbing and expansion. The command should look like this:b pool WIRELESSDEV-80 { select 'node(findstr(http_uri, "bigip=", 6) + ":80")' member 163.231.95.94:http ember 163.231.102.154:http }
If you are entering the select expression from the GUI, put just:node(findstr(http_uri, "bigip=", 6) + ":80"
into the "Node SelectExpression" field on the Pools->Pool->Persistence
page.
The pool statement should work exactly as you have it when entering the configuration by manually editting /config/bigip.conf.
I've tested all of the alternatives on BIG-IP 4.6.4 and all of them worked for me 🙂
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
