iRule to close an established connection
I have tcp (not http) based service where client connections are permanent.
By that I mean that once a connection to a pool member gets established its stays there 24x7.
The pool has 2 pool members configured with priority group.
The first pool member has priority 2 and the second one priority 1, with a Less than '1' value for Priority Group Activation.
The pool also has the setting of 'Reject' for 'Action On Service Down'.
That takes care of any scenario where a pool member is marked down by health monitors.
Whenever a highest priority pool is marked down by health monitors all established connections to that pool members get closed automatically.
The client applications immediately try to reconnect and get established connections to the second pool member with the lower priority.
So far, everything is exactly what we want to accomplish.
The challenge comes when the higher priority pool member is marked up/available once again.
We're looking for an automatic way to close the already established connections to the lower priority pool member as soon as the higher priority pool member becomes available.
Is there a way to do so?
Not sure what event I should use for an already established connection.
First ones that came to mind were LB_SELECTED and CLIENT_ACCEPTED.
So far, I've tried the following options without any results:
when LB_SELECTED {
if { [LB::status pool poolname member 10.0.0.1 80 ] equals "up" and [IP::addr [LB::server addr] equals 10.0.0.2] } {
reject
}
}
when LB_SELECTED {
if { [LB::status pool poolname member 10.0.0.1 80 ] equals "up" and [IP::addr [LB::server addr] equals 10.0.0.2] } {
LB::reselect pool poolname member 10.0.0.1
}
}