• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
  • paul wheaton
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Rob Spoor
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:

Tomcat 6.0.X (could be 18, 26 or 32 tried all 3)

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have Clustering enabled and working as well as a LB with stick sessions, what I do not have is session persistence between members.

I'm unable to get session replication working, or if it is working find any way to monitor it in Tomcat 6.0.18+. After hunting around I found the following setup instructions that also included test code:
http://blogs.agilefaqs.com/2009/11/09/setting-up-tomcat-cluster-for-session-replication/

Using the sample JSP: http://blogs.agilefaqs.com/wp-content/uploads/2009/11/session.jsp

I can see that from a browser it works and if I pass a cookie from a stateless browser (such as curl -b <where -b includes a cookie>) it works as well, however it only works for a single server, if I hit the secondary cluster member (that which did not create the session) it is not present. Hence any time the LB bounces between servers my session is lost.


I set: "rg.apache.catalina.ha.session.ClusterSessionListener.level = ALL" in my logging.properties in order to see what is happening, but I see nothing about sending tickets or receiving tickets in either cluster member's logs. I was expecting to see messages such as: "INFO: SessionListener: sessionCreated('CDC57B8C5CFDFDDC2C8572E7D14C0D28')" or something similar as the sessions are replicated or errors if they are not replicated, basically nothing once started, when starting I do see:
Mar 12, 2011 2:59:22 PM org.apache.catalina.ha.session.DeltaManager waitForSendAllSessions
SEVERE: Manager [10.120.19.54#/cas]: No session state send at 3/12/11 2:58 PM received, timing out after 60,086 ms.
Mar 12, 2011 2:59:22 PM org.apache.catalina.core.ApplicationContext log
Which is ok as I just started up this member and there is no sessions to replicate yet, but I also get it if the other member has sessions present, but it also happens if sessions are present on the other server.


In server.xml I started with the simple:
<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>

and then went to the complex example:
<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster">
<Manager className="org.apache.catalina.ha.session.DeltaManager"
expireSessionsOnShutdown="false"
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"
ttl="1"
dropTime="3000"/>
<Receiver className="org.apache.catalina.tribes.transport.nio.NioReceiver"
address="<server public IP>"
port="4444 <was 4000, but I will have multiple unique cluster eventually>"
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=".*"/>
<Valve className="org.apache.catalina.ha.session.JvmRouteBinderValve"/>

<!-- do want deployment so commented this out
<Deployer className="org.apache.catalina.ha.deploy.FarmWarDeployer"
tempDir="/tmp/cos-temp/"
deployDir="/tmp/cos-deploy/"
watchDir="/tmp/cos-listen/"
watchEnabled="false"/>
-->

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

But they both act the same way I see a message: "INFO: Register manager /cas to cluster element Engine with name Catalina" and then nothing else to do with sessions anywhere in the logs. I also tried tomcat 7.0.11, but CAS does not support it and it fails to load, besides I'm standardized on 6.0.X. I have confirmed that multicast is working and the servers do see each other (via ping and the like), they just exchange no data.


I have 3 questions:
1. Why do sessions not persist between servers?
2. Why is there no session related messages in any logs? (error or success)
Most importantly:
3. How do I get this to work?
4. Is there a way to ensure that clusters only share sessions with other members and not to everyone, is the away to restrict who is added to a cluster?
Answer found elsewhere: change the multicast port so that every cluster is unique that resolves 1 issue.


Thanks,
ERIC
 
There's a hole in the bucket, dear Liza, dear Liza, a hole in the bucket, dear liza, a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic