Erki_Märks_2779
Jan 26, 2011Nimbostratus
drain connections
There are two virtual servers, each have 1 pool with 2 nodes attached to it. The IP addresses of these nodes are the same for both of the pools, only port numbers differ. One node for instance 1.1.1.1 is primary and 1.1.1.2 is the secondary in each of these pools. The application is built so that it connects to the server logs in and the connection remains open. If 1.1.1.1 xx goes down, all connections should go to 1.1.1.2 and connections to 1.1.1.1 should be dropped. For that reason, the action on svcdown is set to drop on both of those pools, but even if i do LB::down and LB::down pool xxx member x.x.x.x xx, the connections stay open. Is there a way to do b conn server 2.2.2.2:80 delete from an irule.
when RULE_INIT
{
if {not([array exists ::arr])}
{
array set ::arr {
"primary" "1.1.1.1"
"secondary" "1.1.1.2"
}
}
}
when CLIENT_ACCEPTED
{
set port "xxxy"
set pool "pool_$port"
set portsec "xxxx"
set poolsec "pool_$portsec"
if { [active_members $pool] > 0 && [array exists ::arr] && [info exists ::arr(primary)] }
{
set secondary "$::arr(secondary)"
set primary "$::arr(primary)"
if {[LB::status pool $pool member $primary $port] != "up" && [LB::status pool $pool member $secondary $port] == "up"}
{
LB::down pool $poolsec member $primary $portsec
set ::arr(primary) "$secondary"
set ::arr(secondary) "$primary"
}
pool $pool member $::arr(primary)
}
else
{
reject
}
}
when LB_FAILED
{
LB::down
LB::down pool $poolsec member [LB::server addr] $portsec
if { [LB::server addr] == "$::arr(primary)" && [active_members $pool] > 0 }
{
if {[LB::status pool $pool member $::arr(secondary) $port] == "up"}
{
set ::arr(primary) $::arr(secondary)
set ::arr(secondary) [LB::server addr]
pool $pool member $::arr(primary)
}
}
}