Forum Discussion

Edward_Gastón_S's avatar
Edward_Gastón_S
Icon for Nimbostratus rankNimbostratus
Jun 05, 2018

iRule Load Balancing Pool

Hello community,

 

I need to know if it is possible with an irule to have a load balance with a different group, for example:

 

Pool1 / Member Pool / Server1 Pool2 / Member Pool / Server1 Pool3 / Member Pool / Server1 Pool4 / Member Pool / Server1

 

Pool5 / Member Pool / Server2 Pool6 / Member Pool / Server2 Pool7 / Member Pool / Server2 Pool8 / Member Pool / Server2

 

The client connects to a virtual server with a tcp 13000 port and I need to distribute the load first in Pool 1, the Second Pool 2, the third Pool 3 and the Fourth Pool 4, in these 4 Pool have the same Server Node1.

 

Then, the client connections go to Pool5, Pool6, Pool7 and Pool8, in theses 4 Pools have the same Server Node2.

 

Then the 8 connections the cycle the connections must be Pool 1, Pool 2, Pool 3, Pool 4, Pool5, Pool6, Pool7 and Pool8.

 

Somebody can help with this iRule, Please.

 

2 Replies

  • Not sure what you are trying to achieve. Certainly you can manipulate SLB options with iRule. You may also think of round-robin or ratio option for pool member selection.

     

  • Hello community I can solved the irule and i share my irule

     

    when RULE_INIT { set ::active_connections 0 set ::Jump 0 set ::Atalla01 "10.1.xx.xx" set ::Atalla02 "10.1.xx.xx" set ::Atalla03 "10.1.xx.xx" set ::Pool_A "Atalla_xxxx_A" set ::Pool_B "Atalla_xxxx_pool_B" set ::Pool_C "Atalla_xxxx_pool_C" set ::PortAtalla xxxx }

     

    when CLIENT_ACCEPTED { log "JUMP : $::Jump" if {([LB::status pool $::Pool_A member $::Atalla01 $::PortAtalla] eq "up") and ([LB::status pool $::Pool_B member $::Atalla02 $::PortAtalla] eq "up") and ([LB::status pool $::Pool_C member $::Atalla03 $::PortAtalla] eq "up")}{ log "ENTRO 0" set ::Jump 0 se balancea hacia el primer nodo } elseif {([LB::status pool $::Pool_A member $::Atalla01 $::PortAtalla] eq "up") and ([LB::status pool $::Pool_B member $::Atalla02 $::PortAtalla] eq "down") and ([LB::status pool $::Pool_C member $::Atalla03 $::PortAtalla] eq "down")}{ log "ENTRO 0 S" set ::Jump 0

     

    se balancea hacia el tercer nodo }

     

    elseif {([LB::status pool $::Pool_A member $::Atalla01 $::PortAtalla] eq "down") and ([LB::status pool $::Pool_B member $::Atalla02 $::PortAtalla] eq "up") and ([LB::status pool $::Pool_C member $::Atalla03 $::PortAtalla] eq "down")}{ log "ENTRO 1" set ::Jump 1 se balancea hacia el segundo nodo } elseif {([LB::status pool $::Pool_A member $::Atalla01 $::PortAtalla] eq "down") and ([LB::status pool $::Pool_B member $::Atalla02 $::PortAtalla] eq "down") and ([LB::status pool $::Pool_C member $::Atalla03 $::PortAtalla] eq "up")}{ log "ENTRO 2" set ::Jump 2

     

    se balancea hacia el tercer nodo } if {$::Jump ==0} { pool Atalla_xxxx_pool_A incr ::active_connections 1 if {$::active_connections %4==0} { set ::Jump 1 } } else { pool Atalla_xxxx_pool_B incr ::active_connections 1 if {$::active_connections %4==0} { set ::Jump 0 } } }