Hi, I don't know if this is the right place, maybe it's a bug in mod_jk, maybe in Tomcat, or maybe there's no bug at all... I have configured a mod_jk loadbalancer on Apache 2. I have two tomcats running on two differents servers. I don't have activated the cluster element in server.xml. Both tomcats are running the same webapp. In the title of every jsp I write the name of the server so that I can check that sticky session works. And it doesn't. Here is my workers.properties : ---------------------------------------------------------- worker.list=loadbalancer,status worker.node1.port=8009 worker.node1.host=noeud_1 worker.node1.type=ajp13 worker.node1.lbfactor=1 worker.node2.port=8009 worker.node2.host=noeud_2 worker.node2.type=ajp13 worker.node2.lbfactor=1 worker.loadbalancer.type=lb worker.loadbalancer.sticky_session=true worker.loadbalancer.balance_workers=node1, node2 # Status worker for managing load balancer worker.status.type=status ---------------------------------------------------------- noeud_1 and noeud_2 are the tomcat servers. In each tomcats I've added the jvmRoute attribute : ---------------------------------------------------------- <Engine name="Catalina" defaultHost="localhost" jvmRoute="noeud_1"> ------------------------------------------------------------ Of course on the noeud_2 server I wrote jvmRoute="noeud_2"... Here is my jk.load file : ----------------------------------------------------------- JkWorkersFile /etc/apache2/workers.properties JkLogFile /var/log/apache2/mod_jk.log JkLogLevel info JkLogStampFormat "[%a %b %d %H:%M:%S %Y]" # JkOptions indicates to send SSK KEY SIZE #JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories JkRequestLogFormat "%w %V %T" JkMount /* loadbalancer JkMount /jkstatus status JkShmFile /var/log/apache2/jk.shm <Location /jkstatus/> JkMount status Order deny,allow Deny from all Allow from all </Location> ------------------------------------------------------------ And finally here is the way I write the server name in jsps : <title><% java.net.InetAddress local = java.net.InetAddress.getLocalHost();out.print(local.getHostName()); %></title> Now the test : I open http://MY_SERVER/ in firefox : I see "noeud_1" in the title. I have a JSESSIONIN in HTTP Headers. I press F5 to reload I see "noeud_2" in the title. I still have the same JSESSIONID... So is it normal ? I think that the point of sticky session is to always redirect to the same server right ? Did I forgot something in some config files ?
I got it to work : the jvmRoute attribute must be the name of the worker, not the name of the server... This is not documented, the doc only says the the jvmRoute mus be unique.
"The second word is the worker name that can be any name. The worker name reflects the name of the jvmRoute defined in Tomcat's server.xml configuration file." Sorry...