Forum Discussion

Les_Marstaeller's avatar
Les_Marstaeller
Icon for Nimbostratus rankNimbostratus
May 24, 2006

Who to tell which server is being selected by an irule

Hi,

 

 

I am using the iRule below to control server pool failover when a pool member goes down:

 

 

-------------------------------------------------------------------------

 

rule http_sticky_failover {

 

when RULE_INIT {

 

set ::active_HTTP 192.168.222.61

 

set ::backup_HTTP 192.168.222.62

 

}

 

when CLIENT_ACCEPTED {

 

pool WS_pool member $::active_HTTP 80

 

}

 

when LB_FAILED {

 

if { [LB::status pool WS_pool member $::backup_HTTP 80] eq "up" } {

 

set temp $::active_HTTP

 

set ::active_HTTP $::backup_HTTP

 

set ::backup_HTTP $temp

 

pool WS_pool member $::active_HTTP 80

 

}

 

}

 

}

 

--------------------------------------------------------------------------

 

 

Is there any way to tell which pool member is currently the active one?

 

 

Also, Is there any way to change which pool member is active, apart from causing a server to go down?

 

 

As always, thanks for help you can give me.

 

 

Les

 

Canberra, Australia.

6 Replies

  • Yep. From the iRules wiki:

     

     

    Description

     

    This command allows you to query for information about the mbmber selected after a load balancing decision has been made.

     

     

     

    Syntax

     

    LB::server

     

    LB::server addr

     

    LB::server name

     

    LB::server pool

     

    LB::server port

     

    LB::server priority

     

    LB::server ratio

     

    LB::server weight

     

    LB::server ripeness

     

     

    LB::server

     

    Returns the currently selected pool

     

    LB::server addr

     

    Returns the IP address of the currently selected pool member

     

    LB::server name

     

    Returns the hostname of the currently selected pool member

     

    LB::server pool

     

    Returns the pool of the currently selected member

     

    LB::server port

     

    Returns the port of the currently selected pool member

     

    LB::server priority

     

    Returns the priority of the currently selected pool member

     

    LB::server ratio

     

    Returns the ratio value of the currently selected pool member

     

    LB::server weight

     

    Returns the weighting of the currently selected pool member

     

    LB::server ripeness

     

    Returns the ripeness information of the currently selected pool member

     

  • Thanks for your help (yet again citizen_elah).

     

     

    Can I just type these at the command line or do they have to be in an irule?

     

     

    Thanks, bye,

     

     

    Les
  • Les, to see your active connections from the cli, use the b conn command:

     

     

     

    b conn 10.1.1.88

     

    10.1.1.88:1706 <-> 10.100.1.24:3389 <-> 10.220.110.23:3389 tcp

     

    b conn 10.1.1.88 show all

     

    VIRTUAL 10.100.1.24:3389 <-> NODE 10.220.110.23:3389

     

    CLIENTSIDE 10.1.1.88:1706 <-> 10.100.1.24:3389

     

    (pkts,bits) in = (1, 528), out = (0, 0)

     

    SERVERSIDE 10.100.3.24:1706 <-> 10.220.110.23:3389

     

    (pkts,bits) in = (0, 0), out = (1, 496)

     

    PROTOCOL tcp UNIT 1 IDLE 69 (230400) LASTHOP 100 00:d0:01:b1:ff:fc