Forum Discussion

Mark_Cook_10885's avatar
Mark_Cook_10885
Icon for Nimbostratus rankNimbostratus
Oct 18, 2006

How to set up a failover node/pool?

 

We have a pool that has 2 nodes in it and request are load balance bewteen those 2 nodes. What we want to do is to send request to a failover node/pool if the original nodes/pool go down.

 

 

So do we:

 

1. Add a 3rd node to the pool and configure it somehow to normally use the first 2 nodes and only use the 3 node as a last resort?

 

2. Do we create a new pool/node and write an iRule to forward the traffic to the failover pool if the primary pool is down?

 

3. Maybe there is another option I am not aware of?

 

 

I thought this would be easy to do, but so far I'm stumped.

 

 

Thanks for any help in advance!

4 Replies

  • This should do the trick...

    when HTTP_REQUEST {
      if { [active_members "def_pool_name"] == 0 } {
        pool "fallback_pool_name"
      }
    }

    Just replace the "def_pool_name" and "fallback_pool_name" with your default and fall back pool names.

    -Joe
  • Hi Joe,

     

     

    The script you given can switch the traffic to standby pool if the active pool fail. Then, how to start a application server and its service that was not running at a standby node? For our case, we also need to remount shared storage to the stadby node at the same time. Are there any way that can restart application server at a standby node before switching traffic? Thanks.

     

     

    John
  • The only thing I can think of would be to build a special command handler on your servers and then when you detect you need the services restarted, modify the payload to the backend server to trigger this operation. Then on response to the BIG-IP, you could reset the original request and issue a HTTP::retry to send the original request to that secondary server.

    something like this comes to mind:

    when HTTP_REQUEST {
      set ORIG_REQ [HTTP::request]
      set $needs_reset (decision logic goes here)
      if { $needs_reset } {
         Change URI to special reset command on server
        HTTP::uri "/reset_services"
      }
    }
    when HTTP_RESPONSE {
      if { $needs_reset } {
         Revert back to original request and retry
        LB::reselect
        HTTP::retry $ORIG_REQ
      }
    }

    You may have to issue a HTTP::collect in the HTTP_REQUEST if you have a large request payload and then process the logic in the HTTP_REQUEST_DATA event instead.

    Hopefully this gives you some food for thought.

    -Joe
  • To elaborate... what about going back to the default pool - would this logic work?

     

     

    when HTTP_REQUEST {

     

    if { [active_members "def_pool_name"] == 0 } {

     

    pool "fallback_pool_name"

     

    }

     

    elseif { [active_members "def_pool_name"] == 1 } {

     

    pool "def_pool_name"

     

    }

     

    }