We have a setup where we have one httpd (apache) with mod_jk talking in a load balance setup to three tomcat servers. We have to recycle each tomcat instance envery three hours. So tomcat1 will restart at 1, and tomcat2 at 2 and ... until tomcat1 recycles again at 4.
We want to configure a script or a type of program to disable the worker node that is going through a recylce to minimize session errors at the user using our application.
Any suggestions.
Chris thanks or your answer. I am sure it will work, but I wanted to trigger the change at run time, even though the graceful restart is very similar. I was able to accomplish my describe task the following way.
In your httpd.conf file you should add the following lines to enable the jkmanager for mod_jk module.
<Location /jkmanager/>
JkMount jkstatus
order deny,allow
allow from <your ip address>
allow from 127.0.0.1
deny from all
</Location>
<IfModule mod_jk.c>
...
JkMount /jkmanager/* jkstatus
...
</IfModule>
The changes on the "workers.properties" file are:
worker.list=router,tomcat1,tomcat2,...,tomcatn,jkstatus
worker.jkstatus.type=status
After these changes are done, you are able to see the jkmanager by typing your url followed by /jkmanager/ at the end. You should get something similar to the following picture.
In order to disable workers at run time just run the following URLs against the jkmanger. You can even read status in an xml format.
To disable tomcat1 just hit:
http://your.web.server/jkmanager/?cmd=update&w=router&opt=256&from=list&att=vwa&val0=1&val1=0&val2=0
To enable tomcat1 back hit:
http://your.web.server/jkmanager/?cmd=update&w=router&opt=256&from=list&att=vwa&val0=0&val1=0&val2=0
I posted a complete article in my blog explaining the setup in case someone needs to know.