Forum Discussion

nevot_66724's avatar
nevot_66724
Icon for Nimbostratus rankNimbostratus
Jul 12, 2008

iControl graceful stop node

Hello,

 

I'm searching for a perl script just to make a 'graceful' stop of one of my webservers.

 

My objective is to add some code to /etc/init.d/httpd for:

 

a) do not accept more connections to the node being stopped

 

b) wait gracefully to the end the last connection to this node

 

c) when load-balancer has no more connections to this node, mark it down

 

d) return control to the script to continue shutdown

 

 

Does anybody have something like it working?

6 Replies

  • The way to gracefully stop a pool member is to first stop all new connections to it by disabling new sessions with the LocalLB.PoolMember.set_session_enabled_state() method.

     

     

    http://devcentral.f5.com/wiki/default.aspx/iControl/LocalLB__PoolMember__set_session_enabled_state.html

     

    Click here

     

     

     

    You will then have to poll the statisitcs for the Pool Member with the LocalLB.PoolMember.get_statistics() method and look at the STATISTIC_SERVER_SIDE_CURRENT_CONNECTIONS statistic.

     

     

    http://devcentral.f5.com/wiki/default.aspx/iControl/LocalLB__PoolMember__get_statistics.html

     

    Click here

     

     

     

    You'll need to continue polling until the current connections drops to zero. At that point you can mark the pool member down with the LocalLB.PoolMember.set_monitor_state() method.

     

     

    http://devcentral.f5.com/wiki/default.aspx/iControl/LocalLB__PoolMember__set_monitor_state.html

     

    Click here

     

     

     

    Hope this helps...

     

     

    -Joe
  • Why would you want to query the LTM for the amount of connections when you have commands available to show you established connections on the box itself?

     

     

    The approach we use is..;

     

     

    - Mark node as down in the LTM

     

    - Watch netstat established connections untill = 0

     

    - Stop the web service

     

    - Update application

     

    - Start web services

     

    - Check web services are responding

     

    - Re-enable in LTM

     

     

    All from a remote perl script
  • Hi,

     

     

    I thought, by disabling the node (not marking down), the LTM will do just exactly what we are trying to do. The document says so.

     

    Below is the extract from the BIG IP documentation:-

     

    ==========

     

    Enabling and disabling a node

     

    A node must be enabled in order to accept traffic. When a node is disabled,

     

    the LTM system allows existing connections to time out or end normally. In

     

    this case, the node can accept new connections only if the connections

     

    belong to an existing persistence session. (In this way a disabled node

     

    differs from a node that is set to down. The down node allows existing

     

    connections to time out, but accepts no new connections.)

     

    ==========

     

     

    Only thing is, if we want to DISABLE the node remotely ( via some script), how do we do it?

     

     

    To mark the node DOWN is simple, we can have a custom http-ecv health monitor, which will act a a remote control to mark the node DOWN. But as the document suggests, by marking the node down , we will also loose the persistent sessions. To save these persistent sessions & have a graceful removal of the node from the pool, we have to DISABLE the node.

     

     

    Any one knows any method to disable the node in F5 via some script ( or any F5 monitor or so) ??

     

     

    regds,

     

    Lee..since1976.
  • Don_MacVittie_1's avatar
    Don_MacVittie_1
    Historic F5 Account
    Hi Lee,

     

     

    The documentation is referencing the Web UI, while in code we take several steps to achieve that goal. There is some good info on this thread: http://devcentral.f5.com/Default.aspx?tabid=53&view=topic&postid=26906&ptarget=27308

     

     

    Including Joe's post toward the bottom with some great links in it.

     

     

    Hope that helps,

     

    Don.
  • Also you can check out the tech tip I wrote on "Graceful Server Shutdown". The app in there disables new connections, queries the stats to wait for all persistent connections to drain, and then disables the pool member.

     

     

    http://devcentral.f5.com/Default.aspx?tabid=63&articleType=ArticleView&articleId=254

     

    Click here

     

     

     

    -Joe