Forum Discussion

Kamalpreet_1068's avatar
Kamalpreet_1068
Icon for Nimbostratus rankNimbostratus
Nov 13, 2014

iRULE to Select Node based on different Pool

There are 2 tasks which i want to complete

 

Summary - I have 2 VIPs one for WEB and APP Each VIP has one pool with 2 nodes(WEB-Pool-- WEBnode1 & Webnode2 APP-Pool-- Appnode1 & Appnode2)

 

Task 1 - I want one node to be active and handling all the connections and if that goes down second node should kick in. If first node comes back online i still want the second node to handle all the traffic till it goes down.

 

Sol - This I am achieving with Priority Activation and Single Node Persistence.

 

Task 2 - If WebNode1 is getting all the traffic then from app pool i want appnode1 should handle all the traffic. If webnode1 goes down and webnode2 is active and i want appnode1 to go down and appnode2 should kick in. Please let me know how we can achieve this. Your help is greatly appreciated

 

1 Reply

  • Arie's avatar
    Arie
    Icon for Altostratus rankAltostratus

    I'm assuming that you want to use Webnode1 and Appnode1. If Webnode1 is down you want to use Webnode2 and Appnode2, except if Appnode2 is down. In that case you still want to use Appnode1.

    To accomplish this (and to prevent hard-coding more node IP-addresses than necessary) I would create a fall-back pool that is the inverse of APP-Pool (i.e. switch the priority groups). In the iRule I used the name APP-Pool-Fallback for this pool.

    Here's the rule you would then apply to the VIP for APP:

    when HTTP_REQUEST {
    
        if { [LB::status pool WEB-Pool member 10.1.2.101 80] eq "down" } {
    
            pool APP-Pool-Fallback
    
        }
    
    }
    

    Note: replace "10.1.2.101" with the IP-address of Webnode1.