Forum Discussion

pjedrzejak's avatar
pjedrzejak
Icon for Nimbostratus rankNimbostratus
Apr 19, 2018

iRule for pool selecting

Hi,

I'm looking for advice from F5 Experts 🙂

I got two pools:

DC_W_pool - nodes in same DC

DC_P_pool - nodes in second DC

I try to achive situation where connection to VIP on DC_W will forward to DC_W_pool only if this pool is UP. If DC_W_pool is DOWN I want to redirect connections to DC_P_pool. I think it's necessary to SNAT this connection.

After some research i wrote iRule like this:

   when CLIENT_ACCEPTED {
      if { LB::down pool  }{
           snat automap
           pool 
      }
      else{
        pool 
      }  
    }

    when LB_FAILED{
      if { LB::down pool  }{
           snat automap
           pool 
      }
      else{
        pool 
      }  
    }

Is it correct?

I know that best solution for that will be a GTM/DNS but there is no chance to buy new equipment/licences at this moment.

Thanks for help!

1 Reply

  • You don't need an iRule to do this if the goal is as simple as "use these pool members until none are available, then use these other pool members." You can use Priority Group Activation instead. Define all the nodes in one pool. Make the pool members that are in DC_W a higher priority than the pool members in DC_P. Specify the minimum as not less than the number of members in pool DC_W. If and when the number of members in the higher priority group (DC_W) falls below the minimum, the members in the lower priority group (DC_P) will be activated.

     

    Several articles on Priority Group Activation can be found here on DevCentral, in case you need more information to get started. And it's way more efficient than using an iRule.