Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
add comment

2 Answers

up vote 1 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
add comment

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
add comment

Your Answer

 
discard

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.