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:kursat.tun...@gmail.com] 
Sent: Friday, April 24, 2009 6:12 PM
To: users@tomcat.apache.org
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: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org


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

Reply via email to