Forum Discussion
Jgawrych_43121
Nimbostratus
Mar 18, 2008Kill all active connections to a Vserver during maintenace....
I'm working through a process for placing our site into maintenace mode for application upgrades etc. This process is going to be handed of to 1st level NOC people who are smart but novices to the BigIP - so I want the act of taking a virtual server in and out of maintenace to be a simple and straight forward as possible.
My preffered method for the NOC is to log onto the LTM and disable all pool members for the pool associated with the VServer we want to do maintenace on.
Local Traffic / Pools / "PoolName" / Members Tab. Disable all members.
I have a simple Irule applied to the VServer that I previously found here on Dev central that redirects browsers to a maintenance page when all pool members are down (see bottom of this message for the iRule).
This works as expected for any NEW connections that are initiated to the Vserver. When all the Nodes in a pool are disable, the users browser goes to the maintenace page
My Problem and what I'm looking for help on is that when we go into maintenace, we want ALL sessions through the Vserver to end and go to maintenace page. Don't care if users are in the middle of something - we want all traffic to the web servers behind the BigIP to stop.
However, by default existing connections will remain connected when node/pool member or virtual servers are marked down. In other words, if a user is logged onto the application and has an open browser session, they will stay active on the application even though we've marked everything down . (I was actually pretty surprised to find that there was not a configuration parameter that would by default immediately stop all traffic to Vserver, Pool, Node if it was disabled)
Problem for us because our maintenace usually has the webservers up and functional but we are running DB updates where we do not want user traffic interacting with the DB.
F5 Support pointed me to some Icontrols to kill TCP connections but I'm not sure if iControls are the best route to take on this.
http://devcentral.f5.com/wiki/default.aspx/iControl/System__Connections__delete_active_connection.html
http://devcentral.f5.com/wiki/default.aspx/iControl/System__Connections__delete_all_active_connections.html
http://devcentral.f5.com/Wiki/default.aspx/iControl/System__Connections.html
Anyone have any suggestions on irules that might be able to help? (e.g. an iRule to identify all active connections to a vserver/pool and kill/reset them, etc) Any different approaches any one has used in their production enviroments for halting all traffic to a given VServer during a maintenace event?
Thanks!
-John G
PS - Running BIG-IP 9.3.1 Build 37.1
******************************************************************
Generic iRule to redirect all traffic when all nodes in a pool are down.
when LB_FAILED {
HTTP::redirect "http://maintenance.sitename.com/"
}
- hoolio
Cirrostratus
Hi John, - Nicolas_Menant
Employee
Hi, - Jgawrych_43121
Nimbostratus
Thanks to the previous posters for responding! I'm new to the LTMs and appreciate your repsonses. I've done some additional research/work on this. - Nicolas_Menant
Employee
Hi, - Kevin_Stewart
Employee
I don't know if this can help, but I built a rule that allows specifically listed people to be able to enable or disable maintenance mode on a VIP. This rule is not dependent on node manipulation, but rather stores information in a global array:when RULE_INIT { array set ::maintmode { } } when HTTP_REQUEST { if { ([ info exists ::maintmode([virtual]) ] and ( $::maintmode([virtual]) == 1 )) or ( [HTTP::uri] equals "/enmaintmode" ) or ( [HTTP::uri] equals "/dismaintmode" ) } { maintenance mode is set or attempting to set or unset switch [HTTP::uri] { "/enmaintmode" { if { [matchclass $::maintenance_mode_users equals [lindex [session lookup ssl [SSL::sessionid]] 1]] } { set ::maintmode([virtual]) 1 HTTP::respond 200 content "Maintenance Mode Settings" } else { send content and die HTTP::respond 200 content $::error_html Connection Close event HTTP_REQUEST disable SSL::session invalidate } } "/dismaintmode" { if { [matchclass $::maintenance_mode_users equals [lindex [session lookup ssl [SSL::sessionid]] 1]] } { set ::maintmode([virtual]) 0 HTTP::respond 200 content "Maintenance Mode Settings" } else { send content and die HTTP::respond 200 content $::error_html Connection Close event HTTP_REQUEST disable SSL::session invalidate } } default { send content and die HTTP::respond 200 content $::maintmode_html Connection Close event HTTP_REQUEST disable SSL::session invalidate } } } }
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects