Forum Discussion
uncommon loadbalancing requirement
Hi,
I don't know how to solve a specific loadbalancing-problem. The situation is:
- Servers A, B and C (Web-Servers)
- A and B can handle all the web requests/respond to all urls (e.g. /company/test1, /company/test2, /company/test3)
- C is a test-system that answers all the requests, but is only connected to the production-system with /company/test1 and to the test-system with /company/test2 and /test3
- C should only be used when A and B are down.
This configuration does not really make sense to me, nevertheless I have to handle it. So, how do I configure the loadbalancing?
First, I would use priority-groups and assign priority 10 to Servers A and B, and priority 5 to Server c. So, Server C is only used when A and B are down/disabled. But how can I make sure, that only /company/test1 is forwarded to Server C?
Thanks in advance
Regards,
Thorsten
10 Replies
- Thomas_Gobet_91
Cirrostratus
Hi Thorsten,
You're right, you have to use priority groups.
Regarding your needs on checking URI, here is an iRule :
when HTTP_REQUEST { if { [HTTP::uri] starts_with "/company/test1" and [LB::server addr] equals "Your_member_IP"}{ return; } else { discard; } }- fat_138651
Nimbostratus
Hi Thomas, I have just started using F5-Loadbalancers, so this will be my first contact with iRules. But this iRule seems to be just the solution I need. Thanks, Thorsten
- Thomas_Gobet
Nimbostratus
Hi Thorsten,
You're right, you have to use priority groups.
Regarding your needs on checking URI, here is an iRule :
when HTTP_REQUEST { if { [HTTP::uri] starts_with "/company/test1" and [LB::server addr] equals "Your_member_IP"}{ return; } else { discard; } }- fat_138651
Nimbostratus
Hi Thomas, I have just started using F5-Loadbalancers, so this will be my first contact with iRules. But this iRule seems to be just the solution I need. Thanks, Thorsten
- fat_138651
Nimbostratus
Hi again,
I had to change the iRule a little bit to fit my needs, but unfortunately it doesn't work. Thats my iRule:
when HTTP_REQUEST { if { (not [HTTP::uri] contains "/test1") and [LB::server addr] equals "10.10.10.3"}{ discard; } }But my Browser only shows the index.html if the iRule is not activated. Did I mess sth. up?
Regards,
Thorsten
- Thomas_Gobet
Nimbostratus
Hi Thorsten,
I made a mistake and I didn't see it before... I'm sorry 😕
Here is the good event matching your needs :
when LB_SELECTED { if { (not [HTTP::uri] contains "/test1") and [LB::server addr] equals "10.10.10.3"}{ discard; } } - fat_138651
Nimbostratus
Hi Thomas,
no problem :). I'm happy that you took time to think about my problem and even if the iRule was not working, you pushed me in the right direction. I am just playing around with the iRule and figured out, that is does not work because [LB:server addr] has no value.
Regarding your latest suggestion, I am not sure if the event LB_SELECTED will work for the [HTTP:uri] command. I'm afraid it will work for [LB:server add] but not for [HTTP:uri] because the reference of [HTTP:uri] says:
Valid Events: CACHE_REQUEST, CACHE_RESPONSE, HTTP_CLASS_FAILED, HTTP_CLASS_SELECTED, HTTP_REQUEST, HTTP_REQUEST_DATA, HTTP_REQUEST_SEND, REWRITE_REQUEST_DONE, SERVER_CONNECTEDWhat can I do? Do I have to check two events? Is that possible?
Thanks, Thorsten
- Thomas_Gobet
Nimbostratus
Yes you can check two events in a same iRule. With that you define a flag if your first event is OK and you'll be able to know in LB_SELECTED if everything was OK before.
- fat_138651
Nimbostratus
So, I am not totally through with testing, but Thomas' solution seems to work. Can anyone explain the sense of "Valid events" to me?
Regard,
Thorsten
- fat_138651
Nimbostratus
Thanks a lot Thomas. I went through the web based training for iRules, but thats just good to get a rough overview. But today I learned many things about troubleshooting iRules :-)
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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