cancel
Showing results for 
Search instead for 
Did you mean: 

Disable Nodes on a schedule

SOLVED
Highlighted
Occasional Contributor

Disable Nodes on a schedule

Is there an easy way to disable nodes on a schedule?

 

We have IIS configured to recycle app pools at designated times.  When this happens the app is down for a minute or two as it doesn't have the necessary data cached in the application state to process transactions. Has anyone written a cron job that will automatically disable specific nodes for 5 minutes at a predetermined time?

2 REPLIES
Occasional Contributor

Re: Disable Nodes on a schedule

I don't think I'd use crond for this, but tackle the timing side of things in traffic script. See:

 

how to launch a website at 5am

 

and then use request.avoidNode( node ) to temporarily avoid a node.

 

Just wondering what it is that you can't achieve by using the regular health monitoring? Because that normally would fit the bill quite neatly without any traffic scripting. The health check monitors will make sure no requests end up at a server that's disabled, and will automatically discover that the node has recovered.

Occasional Contributor

Re: Disable Nodes on a schedule

request.avoidNode did the trick. Thanks!

 

We use healthchecks but they take about 30 seconds to mark the node as down and during this 30 second period requests sent to that node fail.  

 

Here is the code I used for reference 

 

$minutesofday = (sys.time.hour()* 60) + sys.time.minutes();


#Cycle out nodes depending on the time of day
#If time is between 3:05AM and 3:15AM do not use Web05 and Web06
if($minutesofday >= 185 && $minutesofday <= 195) {
request.avoidNode("10.213.1.115:80");
request.avoidNode("10.213.1.116:80");

#If time is between 3:20AM and 3:30AM do not use Web07 and Web08
} else if($minutesofday >= 200 && $minutesofday <= 210) {
request.avoidNode("10.213.1.115:80");
request.avoidNode("10.213.1.116:80");
}