Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Tomcat session replication on failover in a cluster

 
Paul Jacob
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I am running two instances of Tomcat 6.0.20 on the same Windows XP machine with apache 2.2.14 in the front and using mod_jk 1.2.28 for load balancing.

I want to enable session replication. I followed all the http://tomcat.apache.org/tomcat-6.0-doc/cluster-howto.html but it does not behave as expected. I am using the following configuration in server.xml on both instances:

<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">

<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"
channelSendOptions="8">


<Manager className="org.apache.catalina.ha.session.DeltaManager"
expireSessionsOnShutdown="true"
useDirtyFlag="true"
notifyListenersOnReplication="true"/>

<Channel className="org.apache.catalina.tribes.group.GroupChannel">
<Membership className="org.apache.catalina.tribes.membership.McastService"
address="228.0.0.4"
port="45564"
frequency="500"
dropTime="3000"/>
<Receiver className="org.apache.catalina.tribes.transport.nio.NioReceiver"
address="auto"
port="4000" (4001 on the second node)
autoBind="100"
selectorTimeout="5000"
maxThreads="6"/>

<Sender className="org.apache.catalina.tribes.transport.ReplicationTransmitter">
<Transport className="org.apache.catalina.tribes.transport.nio.PooledParallelSender"/>
</Sender>
<Interceptor className="org.apache.catalina.tribes.group.interceptors.TcpFailureDetector"/>
<Interceptor className="org.apache.catalina.tribes.group.interceptors.MessageDispatch15Interceptor"/>
</Channel>

<Valve className="org.apache.catalina.ha.tcp.ReplicationValve"
filter=".*\.gif;.*\.js;.*\.jpg;.*\.png;.*\.html;.*\.css;.*\.txt;"/>
<Valve className="org.apache.catalina.ha.session.JvmRouteBinderValve" enabled="true" sessionIdAttribute="takeoverSessionid"/>

<ClusterListener className="org.apache.catalina.ha.session.JvmRouteSessionIDBinderListener"/>
<ClusterListener className="org.apache.catalina.ha.session.ClusterSessionListener"/>
</Cluster>


</Host>

I tried the above with the <Cluster> element within the <Engine> element too. But the result was the same as given below.

Unfortunately I am getting a message saying 'skipping state transfer. No members active in cluster group' on the second node.
Also, the behaviour is as follows:
1) Start node1, Start node2
2) Hit url ... it goes to node1
3) shutdown node1 and refresh url ... it goes to node2
4) Now, shutdown node2 & start node1
5) User is logged out.

This is not seamless session replication with failover. Am I missing something in the configuration or is it something that just cannot be done?


 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65110
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Morgan Stanley", please check your private messages for an important administrative matter.
 
Paul Jacob
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Anyone faced the same problem?? This is really urgent for a project.
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, the behaviour is as follows:
1) Start node1, Start node2
2) Hit url ... it goes to node1
3) shutdown node1 and refresh url ... it goes to node2
4) Now, shutdown node2 & start node1
5) User is logged out.

This is not seamless session replication with failover. Am I missing something in the configuration or is it something that just cannot be done?


When you shutdown node1 in step#3, then there's no way the session will be replicated from node2 to node1. So in step#4 when you shutdown node#2 and start node#1, it would start afresh.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic