Forum Discussion

damon_schott_19's avatar
damon_schott_19
Icon for Nimbostratus rankNimbostratus
Feb 26, 2010

Pin down a 1 to 1 mappping after node failure.

I currently have the following iRule that pins down load balancing decisions in a 1 to 1 mapping based on source address, this works great except for when there is a failure on any 1 of the port 17000 nodes. There is a persistency requirement that breaks when any 1 of these nodes fail. I am looking for a way to expand on this iRule to basically say "if LB::status pool = "down", then go to the next available node in the pool (meanwhile keeping persistent until the original node comes back online)

 

 

when CLIENT_ACCEPTED {

 

if {[IP::addr [IP::remote_addr] equals 172.17.168.230/32] }{

 

if { [LB::status pool [LB::server pool] member 172.17.168.212 17000 ] == "up" }

 

pool [LB::server pool] member 172.17.168.212 17000

 

}

 

}

 

elseif {[IP::addr [IP::remote_addr] equals 172.17.168.231/32] }{

 

if { [LB::status pool [LB::server pool] member 172.17.168.213 17000 ] == "up" }

 

pool [LB::server pool] member 172.17.168.213 17000

 

}

 

}

 

elseif {[IP::addr [IP::remote_addr] equals 172.17.168.232/32] }{

 

if { [LB::status pool [LB::server pool] member 172.17.168.214 17000 ] == "up" }

 

pool [LB::server pool] member 172.17.168.214 17000

 

 

}

 

}

 

}

4 Replies

  • Hi Damon,

    Is this what you were looking for?

     
      
     when CLIENT_ACCEPTED {  
       if {[IP::addr [IP::remote_addr] equals 172.17.168.230/32] }{  
           if { [LB::status pool [LB::server pool] member 172.17.168.212 17000 ] == "up" }  
              pool [LB::server pool] member 172.17.168.212 17000  
          } elseif { [LB::status pool [LB::server pool] member 172.17.168.213 17000 ] == "up" }  
            pool [LB::server pool] member 172.17.168.213 17000  
          } elseif { [LB::status pool [LB::server pool] member 172.17.168.214 17000 ] == "up" }  
             pool [LB::server pool] member 172.17.168.214 17000 
          }  
       } elseif {[IP::addr [IP::remote_addr] equals 172.17.168.231/32] }{  
           if { [LB::status pool [LB::server pool] member 172.17.168.213 17000 ] == "up" }  
              pool [LB::server pool] member 172.17.168.213 17000  
          } elseif { [LB::status pool [LB::server pool] member 172.17.168.214 17000 ] == "up" }  
            pool [LB::server pool] member 172.17.168.214 17000  
          } elseif { [LB::status pool [LB::server pool] member 172.17.168.212 17000 ] == "up" }  
             pool [LB::server pool] member 172.17.168.212 17000 
          }  
       } elseif {[IP::addr [IP::remote_addr] equals 172.17.168.232/32] }{  
          if { [LB::status pool [LB::server pool] member 172.17.168.214 17000 ] == "up" }  
              pool [LB::server pool] member 172.17.168.214 17000  
          } elseif { [LB::status pool [LB::server pool] member 172.17.168.212 17000 ] == "up" }  
            pool [LB::server pool] member 172.17.168.212 17000  
          } elseif { [LB::status pool [LB::server pool] member 172.17.168.213 17000 ] == "up" }  
             pool [LB::server pool] member 172.17.168.213 17000 
          }  
       }  
     } 
     

    Bhattman
  • Thanks Bhattman, I think that IS what I was looking for; I applied this update to the VIP and will perform the testing. Thanks again.

     

     

    Damon
  • Hi Damon,

     

    I was thinking that perhaps there must be an easier way to accomplish what you are doing while reducing the amount of code in the irule.

     

     

    Another approach is to use priority load balancing.

     

     

     

     

    You could create 3 pools

     

     

    Pool_230 would contain

     

    172.17.168.212:17000 with priority 100 <== Active

     

    172.17.168.213:17000 with priority 50 <== Inactive

     

    172.17.168.214:17000 with priority 25 <== Active

     

    With minimum active member is 1.

     

     

    Pool_231 would contain

     

    172.17.168.212:17000 with priority 25 <== Inactive

     

    172.17.168.213:17000 with priority 100 <== Active

     

    172.17.168.214:17000 with priority 50 <== Inactive

     

    With minimum active member is 1.

     

     

    Pool_233 would contain

     

    172.17.168.212:17000 with priority 25 <== Inactive

     

    172.17.168.213:17000 with priority 50 <== Inactive

     

    172.17.168.214:17000 with priority 100 <== Active

     

    With minimum active member is 1.

     

     

     

    With priority load balancing only 1 member is active at any time - until there is a failure, then next priority takes over

     

     

    Then your irule could be shorted to the following:

     

     

     
     when CLIENT_ACCEPTED { 
       if {[IP::addr [IP::remote_addr] equals 172.17.168.230/32] }{ 
         pool pool_230 
       } elseif {[IP::addr [IP::remote_addr] equals 172.17.168.231/32] }{ 
         pool pool_231 
       } elseif {[IP::addr [IP::remote_addr] equals 172.17.168.232/32] }{ 
         pool pool_232 
       } 
     } 
     

     

     

    I hope this helps

     

     

    Bhattman

     

     

  • Bhattman, thank you, that is terrific. I will certainly give that a try. Thanks again for all your assistance