Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

is it possible to replicate the mod_jk sticky session information to another apache for an failover setup?

the idea behind the question is to setup two apaches with sticky sessions in front off some tomcats. when one apaches fails, the other one should take over the mod_jk session information so he knows which requests to serve to what tomcat.

i know an alternative would be session replication at the tomcat level and not to use sticky sessions, but this is not possible at the moment.

share|improve this question
up vote 2 down vote accepted

If your backend servers (tomcat) are clustered, they should replicate sessions too. In the event of an http failure, connections to 1 http node should go to another node. The jsessionid parameter should give the http / mod_jk enough info to know which node to route to (e.g. jsessionid=lkj234lkj2ljk234lj.jvmRoute1 will tell mod_jk that this session is due for the worker with name jvmRoute1). In the event that the specified worker is unavailable, mod_jk should route to the next worker, which should retrieve the sesison from the cache.

i.e. replication is not needed between httpd servers, as the client-side cookie or URL containing jsessionid contains the routing information.

share|improve this answer

There should be no need to replicate anything between apache nodes, because mod_jk's session persistence is working stateless.

You need to set jvmRoute in Tomcat's server.xml and it has to match the name of your jk workers, used by the balancer in mod_jk.

share|improve this answer
how can it be stateless? there must be some type of storage for the information sessionid xyz goes to jvmRoute1 and sessionid abc goes to jvmRoute3 and so on. i want to replicate this information between apaches. so in the case of a failover the second apache knows where to send the clients. – Christian Jun 23 '10 at 8:51
Tomcat appends the configured jvmRoute (for example the node-name) to the JSESSIONID, so this information is sent within the cookie in each request. Apache/mod_jk extracts this information and sends the request to the right backend node. – powo Nov 23 '10 at 22:53

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.