Forum Discussion
More than one Pools in the same iRule statement Line
I have a scenario, we have created an iRule entry in the iRule section named (New-Proxy1). The situation is that we have four different pools with different ports and i want to call all the four pools in the iRule statement one by one i.e. Pool1, then Pool2, Pool3, then Pool4 which means if all pools have 4 members each then the request should be load balanced round robin in the first pool and the 5th request should land in the 2nd pool 9th request in the 3rd pool and 13th request in the fourth pool.
Is it possible??? As i am trying to avoid to create VS for http/https separately instead i am looking to create a simple iRule statement to do the Load balancing among all the pools sequentially.
Kindly Help or assist or call me at +92-03226118795 or Email me at asif.taj@techaccesspak.com
2 Replies
- Gambler_168259
Nimbostratus
when HTTP_REQUEST { switch -glob [HTTP::uri] { "/InCrmLive*" { pool Tibco-LB-Group31 HTTP::uri [string range [HTTP::uri] [string first "/" [HTTP::uri] 1] end] } } } - nitass
Employee
this may not be optimized. anyway, what it does is to combine all pool members and send traffic to them in round robin fashion.
by the way, cmp is disabled (cmp-enabled no) to make test easier.
configuration root@(ve11a)(cfg-sync In Sync)(Active)(/Common)(tmos) list ltm virtual bar ltm virtual bar { cmp-enabled no destination 172.28.24.10:80 ip-protocol tcp mask 255.255.255.255 profiles { http { } tcp { } } rules { qux } source 0.0.0.0/0 source-address-translation { type automap } vs-index 3 } root@(ve11a)(cfg-sync In Sync)(Active)(/Common)(tmos) list ltm rule qux ltm rule qux { return next index proc getnext { cur max } { set t [expr { $cur + 1}] if { $t >= $max } { return 0 } else { return $t } } when RULE_INIT { pool names set static::pools "foo1 foo2" create list of pool members set static::list "" foreach static::apool $static::pools { set static::list [concat $static::list [eval "members -list $static::apool"]] } total number of pool members set static::len [llength $static::list] pool member counter set static::c 0 } when HTTP_REQUEST { flag to prevent indefinite loop set loop 0 pickup online (up) pool member to simplify coding, monitor is done on node level instead of pool/pool member level while { ([LB::status node [lindex [lindex $static::list $static::c] 0]] ne "up") and ($loop <= 1) } { set static::c [call getnext $static::c $static::len] if { $static::c == 0 } { incr loop } } no pool member is available, so return 500 if { $loop > 1 } { HTTP::respond 500 return } pool member is available, so send to pool member node [lindex [lindex $static::list $static::c] 0] [lindex [lindex $static::list $static::c] 1] increase counter set static::c [call getnext $static::c $static::len] } when HTTP_RESPONSE { log for verification log local0. "server [IP::server_addr]:[TCP::server_port]" } } root@(ve11a)(cfg-sync In Sync)(Active)(/Common)(tmos) list ltm pool foo1 ltm pool foo1 { members { 200.200.200.101:80 { address 200.200.200.101 } 200.200.200.111:80 { address 200.200.200.111 } } } root@(ve11a)(cfg-sync In Sync)(Active)(/Common)(tmos) list ltm pool foo2 ltm pool foo2 { members { 172.28.24.1:80 { address 172.28.24.1 } } } test [root@ve11a:Active:In Sync] config tail -f /var/log/ltm Nov 25 23:56:37 ve11a info tmm[14890]: Rule /Common/qux : server 200.200.200.111:80 Nov 25 23:56:37 ve11a info tmm[14890]: Rule /Common/qux : server 200.200.200.101:80 Nov 25 23:56:37 ve11a info tmm[14890]: Rule /Common/qux : server 172.28.24.1:80 Nov 25 23:56:37 ve11a info tmm[14890]: Rule /Common/qux : server 200.200.200.111:80 Nov 25 23:56:37 ve11a info tmm[14890]: Rule /Common/qux : server 200.200.200.101:80 Nov 25 23:56:37 ve11a info tmm[14890]: Rule /Common/qux : server 172.28.24.1:80 Nov 25 23:56:37 ve11a info tmm[14890]: Rule /Common/qux : server 200.200.200.111:80 Nov 25 23:56:37 ve11a info tmm[14890]: Rule /Common/qux : server 200.200.200.101:80 Nov 25 23:56:37 ve11a info tmm[14890]: Rule /Common/qux : server 172.28.24.1:80 Nov 25 23:56:37 ve11a info tmm[14890]: Rule /Common/qux : server 200.200.200.111:80
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