Forum Discussion

NorCalAdam_6796's avatar
NorCalAdam_6796
Icon for Nimbostratus rankNimbostratus
Jun 20, 2013

Redirect to new pool/port when current pool offline

I am trying to send traffic to a different pool when all nodes in the current pool are down. It also needs to change port number when going to the other pool. Here is what I have so far, it seems to be sending traffic to new pool but not changing the port numbers. Can someone think of a better way to do this or help with my iRule?

 

 

when CLIENT_ACCEPTED {

 

 

if {[active_members pool1] == 0}{

 

if {[active_members pool2] > 0}{

 

pool pool2 x.x.x.x 48010

 

} else {

 

discard

 

}

 

}

 

}

 

 

when LB_SELECTED {

 

 

if {[active_members pool1] == 0}{

 

if {[active_members pool2] > 0}{

 

LB::reselect pool pool2 x.x.x.x 48010

 

 

} else {

 

discard

 

}

 

}

 

}

 

5 Replies

  • Unless you've configured it otherwise, a pool is typically created with assigned port numbers, so you shouldn't have to change the port number in a pool statement (the pool sends traffic to the members in its member list on the assigned ports). Are you attempting to change the pool's assigned port number on the fly.
  • Im just trying to get the application to work when it changes pool. Basically we are load balancing SQL, when all nodes in pool1 go offline I want traffic to go to pool2. Pool1 and pool2 use different ports for SQL.
  • Then you should be able to just use the pool command with the pool name (no IP and port specified) - assuming you've configured the pool members with the right ports.

     

     

    You can probably also get away with just using the CLIENT_ACCEPTED event, unless your SQL connections are long-living and a pool might dies in the middle of a connection?
  • A much easier way to do this would be to use priority groups in your pool.

     

     

    http://support.f5.com/kb/en-us/products/big-ip_ltm/manuals/product/bigip9_0config/ConfigGuide9_0-05-1.html (under "Specifying priority-based member activation")