Hi Robin,
Yes, /var/tomcat$n/webapps/examples/WEB-INF/web.xml contains
<distributable/>
and
/var/tomcat$n/conf/context.xml is like this:
<!--
<Manager pathname="" />
-->
I think the problem is somewhat deeper. Because I can see from the logs that
sessions are replicated when I use BackupManager. I mean, I only change
DeltaManager to BackupManager, open 4 terminal and do
tail -f /var/tomcat$n/logs/localhost.2009-04-25.log
for each instance and
see the following message:
(instance 2)
Apr 25, 2009 2:29:00 AM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: sessionCreated('4A173B54F43792042A4FDB991D48C409.s2')
Apr 25, 2009 2:29:00 AM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: attributeAdded('4A173B54F43792042A4FDB991D48C409.s2',
'numguess', 'num.numberguessb...@4b2dd538')
(intance 4 log message)
INFO: SessionListener: attributeAdded('4A173B54F43792042A4FDB991D48C409.s2',
'numguess', 'num.numberguessb...@3c6833f2')
Apr 25, 2009 2:29:00 AM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener:
attributeReplaced('4A173B54F43792042A4FDB991D48C409.s2', 'numguess',
'num.numberguessb...@3c6833f2')
Apr 25, 2009 2:29:00 AM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener:
attributeReplaced('4A173B54F43792042A4FDB991D48C409.s2', 'numguess',
'num.numberguessb...@5d2a73d9')
Apr 25, 2009 2:29:01 AM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener:
attributeReplaced('4A173B54F43792042A4FDB991D48C409.s2', 'numguess',
'num.numberguessb...@e1bdb58')
Apr 25, 2009 2:29:01 AM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener:
attributeReplaced('4A173B54F43792042A4FDB991D48C409.s2', 'numguess',
'num.numberguessb...@46dd75a4')
---
(no log in instance 1 and 3)
First, BackupManager seems to select the backup node arbitrarly. In this
example, I created the session on jvmRoute s2, it replicated in on s4 which
seemed random to me. In order to eliminate this random behavior, I tried
switching to DeltaManager with exactly same configuration,
Here is the result:
(all instance logs shows this)
Apr 25, 2009 2:33:51 AM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: sessionCreated('3DA2A86518AC780A0832669D168B66FD.s2')
Apr 25, 2009 2:33:51 AM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: attributeAdded('3DA2A86518AC780A0832669D168B66FD.s2',
'numguess', 'num.numberguessb...@2fe6e305')
--
When I refresh the "jsp", I'm changing the session attribute because I can
see from the example:
[Good guess, but nope. Try lower. You have made 18 guesses.]
and balancer-manager shows
Worker URL Route RouteRedir Factor Set Status Elected To
From
ajp://127.0.0.1:12001 s1 1 0 Ok 0 0 0
ajp://127.0.0.1:12002 s2 1 0 Ok 18 0
22K
ajp://127.0.0.1:12003 s3 1 0 Ok 0 0 0
ajp://127.0.0.1:12004 s4 1 0 Ok 0 0
0
But there is nothing in the log as the one in BackupManager
(attributeReplaced..)
So, normally, when I disable "s2" route, session should continue, I must see
the "counter" in the jsp increasing, but it starts over.
Thank you.
(sorry for typos)
Robin Wilson-5 wrote:
>
> Did you comment out the <Manager pathname="" /> line in 'context.xml'? If
> you leave that it, it doesn't use the manager you defined for the cluster.
>
> Also, is your web app defined as '<distributable />' in the 'web.xml' file
> from the webapp dir?
>
>
> --
> Robin D. Wilson
> Director of Web Development
> KingsIsle Entertainment, Inc.
> WORK: 512-623-5913
> CELL: 512-426-3929
> www.KingsIsle.com
>
>
>
> -----Original Message-----
> From: Kursat Tuncel [mailto:[email protected]]
> Sent: Friday, April 24, 2009 6:12 PM
> To: [email protected]
> Subject: Problem with DeltaManager & BackupManager
>
>
> Hi All,
>
> I'm trying to setup a Tomcat Cluster configuration by using the example
> provided in http://www.mbaworld.com/docs/cluster-howto.html
>
> My problem is actually a bit strange. I've been digging the problem for 2
> days but no success.
>
> Here is my configuration:
>
> 4 Tomcat instances on the same machine, version 6.0.18
> I'm using apache as the http connector, version Apache/2.2.11.
>
> Here is my httpd.conf:
> [...]
> <Proxy balancer://ajpCluster>
> BalancerMember ajp://127.0.0.1:12001 route=s1
> BalancerMember ajp://127.0.0.1:12002 route=s2
> BalancerMember ajp://127.0.0.1:12003 route=s3
> BalancerMember ajp://127.0.0.1:12004 route=s4
> </Proxy>
> <Location /examples>
> ProxyPass balancer://ajpCluster/examples stickysession=JSESSIONID
> </Location>
> [...]
>
> Here are the 4 tomcat instances seperate config file
> (each located in /var/tomcat[1-n] as CATALINA_BASE, properly configure
> startup/shutdown scripts, ports etc.)
>
> ---
> <Engine name="Catalina" defaultHost="localhost" jvmRoute="s1">
>
> <!-- The request dumper valve dumps useful debugging information
> about
> the request and response data received and sent by Tomcat.
> Documentation at: /docs/config/valve.html -->
>
> <!--
> <Valve className="org.apache.catalina.valves.RequestDumperValve"/>
> -->
>
> <!-- This Realm uses the UserDatabase configured in the global JNDI
> resources under the key "UserDatabase". Any edits
> that are performed against this UserDatabase are immediately
> available for use by the Realm. -->
> <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
> resourceName="UserDatabase"/>
>
> <!-- Define the default virtual host
> Note: XML Schema validation will not work with Xerces 2.2.
> -->
> <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="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"
> dropTime="3000"/>
> <Receiver
> className="org.apache.catalina.tribes.transport.nio.NioReceiver"
> address="auto"
> port="14001"
> 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"/>
>
> <Deployer
> className="org.apache.catalina.ha.deploy.FarmWarDeployer"
> tempDir="/tmp/war-temp/"
> deployDir="/tmp/war-deploy/"
> watchDir="/tmp/war-listen/"
> watchEnabled="false"/>
>
> <ClusterListener
> className="org.apache.catalina.ha.session.JvmRouteSessionIDBinderListener"/>
> <ClusterListener
> className="org.apache.catalina.ha.session.ClusterSessionListener"/>
> </Cluster>
> </Host>
> </Engine>
> ---
>
> jvmRoute value and NioReceiver port value is 1-n for all 4 tomcat
> instances
> (i.e., s1, s2, s3, s4 and
> 14001, 14002, 14003, 14004 for the instances)
>
>
> Theoretically, this configuration should work.
>
> I deployed "examples" application provided in tomcat examples and made it
> "</distributable>" in web.xml of the application. I also used "Number
> guess"
> game provided in examples application. I had to modify NumGuessBean.java
> to
> implement java.io.Serializable.
>
> So my setup seems ok upto now.
>
> When I start tomcat instances, and run the example, I see from the
> localhost.xxx.log that session is created on all nodes.
>
> i.e.
> ..
> INFO: SessionListener:
> sessionCreated('78C5694D20B69F54D5CEBD26F10D788D.s1')
> Apr 25, 2009 1:34:51 AM org.apache.catalina.core.ApplicationContext log
> INFO: SessionListener:
> attributeAdded('78C5694D20B69F54D5CEBD26F10D788D.s1',
> 'numguess', 'num.numberguessb...@19de0b5e')
> ..
>
> Now my problem starts where.
>
> When I start changing the value of session attribute by hitting "Refresh"
> button, I don't see any replication happenning. Normally, I should see
> "attributeReplaced" messages in the log. How to I know this, because
> exactly
> same configuration but using "BackupManager" instead of "DeltaManager" it
> happens exactly like this. But BackupManager only "backups" to one node to
> another, i.e., it replicates deltas between two instances only, and the
> choice of selecting this backupnode seems to be completely arbitrary.
> These
> is nothing in the documentation how backup node is selected.
>
> Also using balancer-manager handler in Apache, I disable the jvm instance
> that my session was created and redirect it to another JVM. With
> deltaManager, session start from beginning. With backup manager, session
> continues only if I can select the right jvm, that is the backup of the
> instance.
>
> So it seems that I'm stuck with setting up a cluster configuration.
>
> Has anyone tried Tomcat 6.0.18 with Apache 2.2.11, sticky session mode
> with
> mod_proxy_ajp?
>
> I'm stucked with this configuration.
> --
> View this message in context:
> http://www.nabble.com/Problem-with-DeltaManager---BackupManager-tp23226268p23226268.html
> Sent from the Tomcat - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
>
--
View this message in context:
http://www.nabble.com/Problem-with-DeltaManager---BackupManager-tp23226268p23226529.html
Sent from the Tomcat - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]