Forum Discussion
How to control pool selection in VS when you have more than one pool?
I have Two pools that i have created in a VS i.e. pool1 and pool2 on LTM. Using round-robing services isnt a factor at the moment (HTTP) LTM sends Session A to Pool 1 node 1 and 2. If node 1 on pool 1 goes offline LTM should persists to any members within pool 1 and should not send the traffic to pool2 and vice versa. Any new connections can go to the either pool1 or pool2.
is there a way to create an irule for this?
10 Replies
- TechT
Nimbostratus
Hi msalah, what traffic you want to sent it to pool 1 and pool 2 ? is there any specific condition you required to sent the traffic to respective pools ?
- msalah_199040
Nimbostratus
Hi Maneesh,
I am trying to send HTTP traffic.
So for example if SERVER A hits the VIP at this stage has option to either use POOL-1 or POOL-2 for this instance it gets pushed to Pool 1 with 2 node NODE-A and NODE-B RR selects NODE-A responds all good.
If SERVER A hits the same VIP again it gets the same option to either use POOL-1 or POOL-2 but this time POOL-1 has NODE-A as down. I want this session to then keep using POOL 1 and use NODE-B rather than moving to POOL-2.
But if SERVER B attempts to connect with a new session it can use either POOL-1 or POOL-2
Is this possible?
Thanks
- Stanislas_Piro2
Cumulonimbus
If i understand your need:
you want to load balance to 4 servers:
- Server1 (POOL1, NODE-A in your example)
- Server2 (POOL1, NODE-B in your example)
- Server3 (POOL2, NODE-A in your example)
- Server4 (POOL2, NODE-B in your example)
And you want the following behavior:
- If Server1 become unreachable, you want persistent sessions will be balanced to Server2
- If Server2 become unreachable, you want persistent sessions will be balanced to Server1
- If Server3 become unreachable, you want persistent sessions will be balanced to Server4
- If Server4 become unreachable, you want persistent sessions will be balanced to Server3
- msalah_199040
Nimbostratus
yes thats correct @Stanislas
Thank you
- msalah_199040
Nimbostratus
can this be done with iRules?
- Stanislas_Piro2
Cumulonimbus
You can use :
- PERSIST_DOWN event which is raised if persistence pool member become unavailable.
- LB::persist command to get the previous member in persistence records
- pool member to select the new member
you do not need to create 2 pools but only one
- msalah_199040
Nimbostratus
Thanks @Stanislas is there a irule syntax to do this as well?
- Techgeeeg
Nimbostratus
Hi Msalah,
I will back the reply of Stanislas, as explained by Stanislas you don't need to create two pools you can achieve this by one pool.
Regards,
- msalah_199040
Nimbostratus
i have found a way to do this....thank you again for all your help...
when CLIENT_ACCEPTED { set first-octet [expr {[getfield [IP::client_addr] "." 1]}] if { [$first-octet <=128] { set DC_LOCATION 1} elseif { set DC_LOCATION 2} if { $::DC_LOCATION == 1 } and ([active_members pool_1] >= 1){ pool pool_1 persist source_addr } elseif { $::DC_LOCATION == 2 } and ([active_members pool_2] >= 1) pool pool_2 persist source_addr } elseif { ([active_members pool_1] >= 1) pool pool_1 persist source_addr } elseif { ([active_members pool_2] >= 1) pool pool_2 persist source_addr } }
- msalah_199040
Nimbostratus
alternative way to do this....
when RULE_INIT { set ::NEXT_POOL 0 }
when CLIENT_ACCEPTED { if { $::NEXT_POOL == 0 } and ([active_members pool_1] >= 1){ pool pool_1 persist source_addr set ::NEXT_POOL 1 } else { pool pool_2 persist source_addr set ::NEXT_POOL 0 } }
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