Forum Discussion
IRule for sending traffic to another server if the first server is down or second server is down
Does anyone have any input on how I can send traffic via an iRule if the following scenario occurs? Server A is offline, send all traffic to pool member Server B. If Server A and B are down, send all traffic to pool member C.
Thanks
6 Replies
- Kevin_Stewart
Employee
Priority group.
In the pool, set Priority Group Activation to "less than 1", then give each pool member a priority number. The higher the number the greater the priority. Example:
ServerA - priority 3 ServerB - priority 2 ServerC - priority 1With Priority Group Activation, all traffic will be sent to priority number 3 servers until they all fail, then priority number 2 servers, and then priority number 1. Also makes sure you have a good monitor applied to the pool. No iRule required.
- sande06_81266
Nimbostratus
I probably should have mentioned that the 3rd server or server C would be a vip that exists on the f5 load balancer. So really it should read: If server A is offline, send all traffic to server B. If server A and B are down, then send all traffic to an existing vip on the f5 load balancer. - sande06_81266
Nimbostratus
Will this cause an issue within the f5 if we are sending the traffic back to an existing vip? - Kevin_Stewart
Employee
Do you mean that you want to send traffic to another VIP behind the first VIP, or simply redirect to the third VIP is servers A and B are offline? - sande06_81266
Nimbostratus
Yes, it would be like a redirect traffic to this vip if server A and B are down. - Kevin_Stewart
Employee
Yes, it would be like a redirect traffic to this vip if server A and B are down.
Okay, so same priority group settings for servers A and B, and the following iRule:
when CLIENT_ACCEPTED { set default_pool [LB::server pool] } when HTTP_REQUEST { if { [active_members $default_pool] < 1 } { HTTP::redirect "http://foo.example.com" } }All traffic will go to server A until it fails, then to server B until it fails. If servers A and B fail, the client will be issued an HTTP redirect to the URL of choice.
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