Forum Discussion
Chris_Day_10331
Nimbostratus
Dec 27, 2005iRules for Individual Testing of Farm Servers
Hello wonderful people at DevCentral!
I have a follow-up to an earlier post I had made “iRule for Server Testing” (http://devcentral.f5.com/default.aspx/Default.aspx?tabid=28&forumid=5&postid=4603&view=topic) regarding the re-writing of URLs to facilitate testing of individual pool members for a particular application.
I was not successful in getting this to work, primarily because I believe I may have approached the problem from the wrong angle. I wanted to start this from the “top down” to see what all you smart people think is the best approach to achieve the end result.
THE PROBLEM:
We now have 16 web servers (among 16 app servers, db servers, etc) each of which services a number of applications (currently 6 but not likely to exceed 50 to 100). The applications are distinguished from one another only by HTTP/1.1 host header. As a new server is brought into production it is very difficult to ensure that it is responding properly for each of the 6 applications (and some other reasons beyond the scope of this post). As this number grows linearly, it is increasingly difficult and time consuming to test and more importantly locate issues with the deployment of the app to each of the boxes. A sample application served by each of the 16 boxes would be:
http://application1.company.com/
THE GOAL:
I was hoping to make it such that we could provision an additional VS (with either an internal or external IP) and enable testers to test a particular application on a particular server as follows:
http://application1.test.company.com/web001/ OR
http://application1.test.company.com/10.10.20.54/
This would require minimal DNS maintenance as new applications were added since it could be achieved by creating a single wildcard sub-domain (*.test.company.com pointing to VS IP Address). My goal was then to have the BIG-IP parse the “/web001/” portion and determine from a lookup table of some kind that I, the tester, was trying to load “application1.company.com” from server “web001”. In the latter example, it would obviously determine that I wanted to have the specified application served by the server who's IP address I provided.
The critical part was that the server be unaware of all the fancy rewriting going on and believe that the client was actually requesting http://application1.company.com/ (without the “/web001/”). I wanted the URLs back to the client to be re-written with the “/web001/” to enable the site to best tested/navigated seamlessly (i.e. not just the initial request).
As I am not a developer or particularly strong with iRules, I was hoping that someone could pick this up and help. There is no real rush on this, but needless to say the current solution which involves the continuous editing of hosts files is quite ugly.
I really appreciate all the help you guys have provided in the past (I still owe some beers) and thank you in advance for reading this post.
Cheers,
Chris
17 Replies
- Deb_Allen_18Historic F5 Account...just a couple more small corrections:
when HTTP_REQUEST { set myNode [findstr [HTTP::uri] "node=" 5 "&"] if {($myNode ne "") \ and ([LB::status pool http-pool-mypool member $myNode 80] eq "up")}{ log "Node found." pool http-pool-mypool member $myNode 80 } else { log "Node not found." pool http-pool-mypool } }
/deb - Chris_Day_10331
Nimbostratus
Awesome guys, great help - and now things are 99% working!
I have applied this to both a http-myVS and https-myVS assuming that my default persistence profile would apply - i.e. when I hit:
http://myVS/home.aspx?node=10.10.20.51 - Sent to 10.10.20.51 - YAY
Then, I go to the URL without the ?node= part, expecting to get stuck to the same node:
http://myVS/home.aspx - Sent to 10.10.20.52 - BOO!
It seems like when I hit the ?node= thing my persistence goes away.... until I hit the normal, non-"node?" URL, at which point is seems to stick properly, including when I switch from HTTP to HTTPS. I tried monkeying a little by adding "persist cookie" just before the "pool http-pool-mypool" statement but this does not appear to work. Any thoughts?
Thanks,
Chris - unRuleY_95363Historic F5 AccountYes, we know about this issue. CR60667 - persistence doesn't work when directly selecting pool members.
You can work around it by setting a variable when you directly select the pool member (maybe something like "set used_pool_member 1") and then add another event to add the persistence record when that variable is set:
Just be sure to use whatever persistence type you had configured (you didn't say whether it was source address or something else).when SERVER_CONNECTED { if { [info exists used_pool_member] && $used_pool_member } { persist add source_addr } } - Chris_Day_10331
Nimbostratus
Hey unRuleY, thanks... I can't seem to get it to work tho. Here's what it looks like now:when HTTP_REQUEST { set myNode [findstr [HTTP::uri] "node=" 5 "&"] if {($myNode ne "") and ([LB::status pool http-pool-mypool member $myNode 80] eq "up")}{ log "Node found." set used_pool_member 1 pool http-pool-mypool member $myNode 80 } else { log "Node not found." persist cookie pool http-pool-mypool } } when SERVER_CONNECTED { if { [info exists used_pool_member] && $used_pool_member } { persist cookie } }
...I'm using the fancy dancy iRuler... HOT!
Chris - unRuleY_95363Historic F5 AccountChris,
There's a difference between selecting persistence and actually adding it. That's what the extra "add" keyword does in the example I posted. I had guessed that you might be using source address persistence, not cookie persistence. There is no means to "add" a cookie persistence record to the BigIP since the cookie actually stores the persistence on the client. So, what you need to do instead of "persist cookie" is to actually insert the persistence cookie using the "HTTP::cookie insert" command. I'll leave it to you as an exercise to figure out how to set the right name and format for the cookie. Everything you need has been posted on the forum at some time or another. - Chris_Day_10331
Nimbostratus
Hi There,
Does anyone know if CR60667 was resolved and if so in what version? Will setting persistence when directly selecting a pool member now work:when HTTP_REQUEST { set myNode [findstr [HTTP::uri] "node=" 5 "&"] if {($myNode ne "") \ and ([LB::status pool http-pool-mypool member $myNode 80] eq "up")}{ log "Node found." pool http-pool-mypool member $myNode 80 } else { log "Node not found." pool http-pool-mypool } }
Is there anything I need to do to this rule to make it so that the "pool member 80" actually creates the appropriate persistence entry per the vs specifications?
Thank you!
Chris - JRahm
Admin
It's still listed as a known issue in the 9.4 release notes, you might open a support to see if the CR is committed to the next release or a current hotfix.
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