« Well House Manor in the Snow | Main | Java beans and classes, .war and .jar files »

February 09, 2007

Heartbeat script in Perl

Scenario ... an Apache httpd web server is distributing requests around between a number of Apache Tomcat instances on different computers (perhaps using mod_rewrite to allocate the requests). If a Tomcat instance become unavailable (i.e. if the host running it is taken offline) then it's to be removed from the pool, and if it comes back on line it's to be added to the pool again.

Sound complex? The basis can be quite a simple Perl script such as the one we wrote during today's course - source code here.

A regular ping around the machines that may be in the pool establishes which are present, and if the availabiity has changed the RewriteMap is rewritten. Place a pause of a few seconds into the loop and try again ....

Posted by gje at February 9, 2007 05:28 PM

Comments

Post a comment




Remember Me?


Well House Consultants Ltd. Copyright 2008