0

I want to be able to Load Balance two Tomcat servers, that are broadcasting Session Data to one another, using Apache and mod_jk.

I've set up the Load Balancer and that works perfectly, however, I'm currently having to use sticky_sessions to make this work. I want to be able to set sticky_sessions to false, and be able to only use a single Session ID to be sent to either Tomcat server.

Is there any specific config needed to make this possible, or is it even possible?

Here is my worker.properties file:

worker.list=jkstatus, jkmanager, LoadBalancer

worker.jkstatus.type=status
worker.jkmanager.type=status
worker.LoadBalancer.type=lb

worker.worker1.type=ajp13
worker.worker1.host=TOMCAT-1-IP
worker.worker1.port=8009

worker.worker2.type=ajp13
worker.worker2.host=TOMCAT-2-IP
worker.worker2.port=8009

worker.LoadBalancer.balance_workers=worker2,worker1
worker.LoadBalancer.sticky_session=0

I have also set up jvmRoutes in each tomcat instance, as 'worker1' and 'worker2', like I said, with the sticky_session set to '1' this works, but I'm forced to use one Tomcat for the duration of that session which I don't want.

I need to be able to go to any Tomcat with a single Session ID, any help would be greatly appreciated.

Andrew Burns
  • 63
  • 1
  • 8
  • Do you have enabled a DeltaManager for session replication? – Stefan Mar 11 '14 at 12:13
  • 1
    Yes, I have `` under my Cluster parameter in server.xml – Andrew Burns Mar 11 '14 at 12:15
  • 1
    You only need to set sticky_session=0 (restart apache) and add the flag to your web.xml. Session id will be suffixed with the Tomcats node name. – Stefan Mar 11 '14 at 12:27
  • I've added the flag, and I'm getting the right traffic from the server, what I want is for both Tomcats to work without the Tomcat node name appended on the end the Session ID, is there a way Apache can just route to any Tomcat without the Session ID having the node name on the end? – Andrew Burns Mar 11 '14 at 12:42
  • Guess not but why not splitting off the '.node' suffix where needed? – Stefan Mar 11 '14 at 12:46
  • I've managed to get it up and running now, I didn't have my Tomcats set up properly to broadcast sessions to one another, I was running one Tomcat 6 and one Tomcat 7 without be aware of their versions. – Andrew Burns Mar 11 '14 at 14:17
  • Why are you so concerned about the value of the session id itself? – Christopher Schultz Mar 11 '14 at 20:50

0 Answers0