William_Benett1
Jul 11, 2007Nimbostratus
Node status problems
I have an iRule that uses LB::status to check the state of a node. Based on that, I then load balance to it or not. I'm running 9.3.0 and I've run into an issue where the node shows up green for TMM but LB::status returns "down". What's up with that?
Here's the rule. Support bounced me to DC. This rule performs load balancing for a very weird application.
when RULE_INIT {
array set ::session_table { }
set ::lbcurrent 0
set ::BSIFlowPort 49151
set ::BSIFhighPort 49250
set ::BSIFNODE1 "x.x.x.x"
set ::BSIFNODE2 "x.x.x.y"
}
when CLIENT_ACCEPTED {
set lport [TCP::local_port]
switch -glob [TCP::local_port] {
49* { if { $lport > $::BSIFlowPort && $::BSIFhighPort > $lport} {
if { ! [expr {$lport & 1}]} {
switch $::lbcurrent {
0 {
if { [LB::status node $::BSIFNODE1 up] == 0 } {
log local0. "chose node 2, node 1 status:\
[LB::status node $::BSIFNODE1]"
set tableentry "[IP::client_addr]:$lport"
set ::session_table($tableentry) $::BSIFNODE2
set ::lbcurrent 1
node $::BSIFNODE2
} else {
log local0. "chose node 1, node 1 status:\
[LB::status node $::BSIFNODE1]"
set tableentry "[IP::client_addr]:$lport"
set ::session_table($tableentry) $::BSIFNODE1
set ::lbcurrent 1
node $::BSIFNODE1
}
}
1 {
if { [LB::status node $::BSIFNODE2 up] == 0 } {
log local0. "chose node 1, node 2 status:\
[LB::status node $::BSIFNODE2]"
set tableentry "[IP::client_addr]:$lport"
set ::session_table($tableentry) $::BSIFNODE1
set ::lbcurrent 0
node $::BSIFNODE1
} else {
log local0. "chose node 2, node 2 status:\
[LB::status node $::BSIFNODE2]"
set tableentry "[IP::client_addr]:$lport"
set ::session_table($tableentry) $::BSIFNODE2
set ::lbcurrent 0
node $::BSIFNODE2
}
}
}
} else {
set evenport [ expr { $lport - 1} ]
set tableentry "[IP::client_addr]:$evenport"
if { $::session_table($tableentry) == "" } {
reject
} else {
log local0. "we got here with [TCP::local_port]"
node $::session_table($tableentry) $lport
}
}
}
}
default { discard }
}
}
when CLIENT_CLOSED {
if { ! [expr [TCP::local_port] &1]} {
set tableentry "[IP::client_addr]:[TCP::local_port]"
if { $::session_table($tableentry) == "" } {
unset $::session_table($tableentry)
}
}
}