You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by János Löbb <ja...@yale.edu> on 2011/04/12 21:14:58 UTC

[Cluster] Sanity check

Hi,

/Httpd 2.2.17, mod_jk 1.2.31, tomcat 7.0.10, OSX 10.6.5/

Looks like there is something I do not get regarding Tomcat clustering, so I do here a sanity check :-)

I have two machines with one tomcat on both.

I use one of the machines as reverse proxy.  here is the reverse proxy conf from the httpd.conf file:

ProxyRequests Off
<Proxy balancer://pathCluster>
	BalancerMember http://bml0065.yalepath.org loadfactor=10 
	BalancerMember http://bml0066.yalepath.org loadfactor=10 
	ProxySet lbmethod=bytraffic
</Proxy>
ProxyPass	/tc/ balancer://pathCluster/ 
ProxyPassReverse	/tc/ balancer://pathCluster/
ProxyPassReverseCookiePAth	/ /
ProxyPassReverseCookieDomain	/ /

The reverse proxy passes the request to one of the balance members.  The balance member see that the request is for tomcat and passes it to mod_jk.  Mod_jk is checking its workers.properties file and based upon the load it passes the request to one of the two Tomcat instances.  Here is one of the workers.properties file:

bml0065:local administrator$ cat apache2/conf/workers.properties 
worker.list = lb,jkstatus

worker.lb.type=lb
worker.lb.balance_workers=tomcat1,tomcat3
worker.lb.sticky_session = True
worker.lb.sticky_session_force = False

worker.jkstatus.type=status

worker.tomcat1.type = ajp13
worker.tomcat1.host = bml0066.yalepath.org
worker.tomcat1.port = 8109
worker.tomcat1.lbfactor = 1
worker.tomcat1.redirect=tomcat3

worker.tomcat3.type = ajp13
worker.tomcat3.host = bml0065.yalepath.org
worker.tomcat3.port = 8309
worker.tomcat3.lbfactor = 1
worker.tomcat3.redirect=tomcat1

To check session replication and session failover, I use the SessionExmaple servlet from the supplied examples webapp this way:
http://bml0065.yalepath.org/tc/examples/servlets/servlet/SessionExample

bml0065 is the reverse proxy.  When I see that the session is created I shut down that tomcat which hosts the session and add another session attribute via the SessionExample servlet.  The mechanism is working fine, the session fails over to the other tomcat instance.  I add more session attribute, and start up the previously shouted down tomcat instance, add more attribute, then I shut down the other tomcat instance and check for fail over, etc..etc..  Everything works.

Then I do not shut down tomcat, just stop the examples webapp on that tomcat instance where currently the session resides and try to add more session attribute.  Instead of failing over, I receive a 404 error:

HTTP Status 404 - /examples/servlets/servlet/SessionExample
type Status report
message /examples/servlets/servlet/SessionExample
description The requested resource (/examples/servlets/servlet/SessionExample) is not available.
Apache Tomcat/7.0.10

My understanding is that the request should be rerouted to the other tomcat instance and present the sessions from that machine, the same way when tomcat itself was stopped.  However that is not what happenzzzz.

So the question is what do I miss in this process ?

Thanks ahead,

János


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org