You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Troy Davidson <td...@cmcflex.com> on 2006/06/13 22:53:37 UTC

Problem clustering with multiple nodes

I am trying to get a horizontal and vertical cluster working.  There are 
three servers with two instances on Tomcat on each one.  The six Tomcat 
instances are to share session data amongst themselves.  The vertical 
clustering works fine.  I can log into the app on a server and if I stay 
on that server, the session is replicated.

But, as soon as I go to another server, the session is lost and I have 
to re login.

I see in the catalina.out that all the Tomcat instances are added:

NFO: Replication member 
added:org.apache.catalina.cluster.mcast.McastMember[tcp://10.9.100.2:4025,catalina,10.9.100.2,4025, 
alive=3]

There is an entry for each Tomcat that will be in the cluster.

I can't find any problem with how things are setup, but obviously there 
is a problem.   Here are the server.xml from two separate Tomcat's on 
separate servers.  If someone in the know can take a look and let me 
know if there is a problem, that would be great.  The servers can see 
each other and communication is happening.

++++++++++++++++++++++++++++++++++++++++++++++++++++++

server.xml from Tomcat4 on server1:

<Server port="14005" shutdown="SHUTDOWN">

  <Listener className="org.apache.catalina.core.AprLifecycleListener" />
  <Listener 
className="org.apache.catalina.mbeans.ServerLifecycleListener" />
  <Listener 
className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
  <Listener 
className="org.apache.catalina.storeconfig.StoreConfigLifecycleListener"/>

  <GlobalNamingResources>

    <Environment name="simpleValue" type="java.lang.Integer" value="30"/>

    <Resource name="UserDatabase" auth="Container"
              type="org.apache.catalina.UserDatabase"
       description="User database that can be updated and saved"
           factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
          pathname="conf/tomcat-users.xml" />

  </GlobalNamingResources>

  <Service name="Catalina">


    <Connector port="14080" maxHttpHeaderSize="8192"
               maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
               enableLookups="false" redirectPort="14443" acceptCount="100"
               connectionTimeout="20000" disableUploadTimeout="true" />

    <Connector port="14009"
               enableLookups="false" redirectPort="14443" 
protocol="AJP/1.3" />

    <Engine name="Standalone" defaultHost="localhost" jvmRoute="jvm14">


      <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
             resourceName="UserDatabase"/>

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

        <Cluster 
className="org.apache.catalina.cluster.tcp.SimpleTcpCluster"
                 
managerClassName="org.apache.catalina.cluster.session.DeltaManager"
                 expireSessionsOnShutdown="false"
                 useDirtyFlag="false"
                 notifyListenersOnReplication="true">

            <Membership
                className="org.apache.catalina.cluster.mcast.McastService"
                mcastAddr="228.0.0.4"
                mcastPort="45564"
                mcastFrequency="500"
                mcastDropTime="3000"/>

            <Receiver
                
className="org.apache.catalina.cluster.tcp.ReplicationListener"
                tcpListenAddress="10.9.100.1"
                tcpListenPort="4014"
                tcpSelectorTimeout="100"
                tcpThreadCount="6"/>

            <Sender
                
className="org.apache.catalina.cluster.tcp.ReplicationTransmitter"
                replicationMode="pooled"
                ackTimeout="15000"
                waitForAck="true"/>

            <Valve 
className="org.apache.catalina.cluster.tcp.ReplicationValve"
                   
filter=".*\.gif;.*\.js;.*\.jpg;.*\.png;.*\.htm;.*\.html;.*\.css;.*\.txt;"/>

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

    <Context path="" docBase="app" debug="0">
    </Context>

    <Context path="/app" docBase="app" debug="0">
    </Context>
      </Host>
    </Engine>
  </Service>
</Server>



++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

server.xml from Tomcat5 on server2:

<Server port="25005" shutdown="SHUTDOWN">
  <Listener className="org.apache.catalina.core.AprLifecycleListener" />
  <Listener 
className="org.apache.catalina.mbeans.ServerLifecycleListener" />
  <Listener 
className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
  <Listener 
className="org.apache.catalina.storeconfig.StoreConfigLifecycleListener"/>

  <GlobalNamingResources>
    <Environment name="simpleValue" type="java.lang.Integer" value="30"/>
    <Resource name="UserDatabase" auth="Container"
              type="org.apache.catalina.UserDatabase"
       description="User database that can be updated and saved"
           factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
          pathname="conf/tomcat-users.xml" />
  </GlobalNamingResources>
  <Service name="Catalina">

    <Connector port="25080" maxHttpHeaderSize="8192"
               maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
               enableLookups="false" redirectPort="25443" acceptCount="100"
               connectionTimeout="20000" disableUploadTimeout="true" />

    <Connector port="25009" enableLookups="false" redirectPort="25443" 
protocol="AJP/1.3" />
    <Engine name="Standalone" defaultHost="localhost" jvmRoute="jvm25">
      <Realm className="org.apache.catalina.realm.UserDatabaseRealm"  
resourceName="UserDatabase"/>
      <Host name="localhost" appBase="webapps"  unpackWARs="true" 
autoDeploy="true"  xmlValidation="false" xmlNamespaceAware="false">

        <Cluster 
className="org.apache.catalina.cluster.tcp.SimpleTcpCluster"
                 
managerClassName="org.apache.catalina.cluster.session.DeltaManager"
                 expireSessionsOnShutdown="false"
                 useDirtyFlag="false"
                 notifyListenersOnReplication="true">

            <Membership
                className="org.apache.catalina.cluster.mcast.McastService"
                mcastAddr="228.0.0.4"
                mcastPort="45564"
                mcastFrequency="500"

                mcastPort="45564"
                mcastFrequency="500"
                mcastDropTime="3000"/>

            <Receiver
                
className="org.apache.catalina.cluster.tcp.ReplicationListener"
                tcpListenAddress="10.9.100.2"
                tcpListenPort="4025"
                tcpSelectorTimeout="100"                 
tcpThreadCount="6"/>
            <Sender
                
className="org.apache.catalina.cluster.tcp.ReplicationTransmitter"
                replicationMode="pooled"
                ackTimeout="15000"
                waitForAck="true"/>

            <Valve 
className="org.apache.catalina.cluster.tcp.ReplicationValve"
                   
filter=".*\.gif;.*\.js;.*\.jpg;.*\.png;.*\.htm;.*\.html;.*\.css;.*\.txt;"/>

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


    <Context path="" docBase="app" debug="0">
    </Context>

    <Context path="/app" docBase="app" debug="0">
    </Context>

      </Host>

    </Engine>

  </Service>

</Server>


++++++++++++++++++++++++++++++++++++++++++++++++++++++++++



-- 
++++++++++++++++++++++++++++++++++
Troy Davidson
Java Programmer
PC/Web Team

CMC/Flex
8520 South Sandy Parkway
Sandy, UT  84070
(801) 365-5000
www.cmcflex.com


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


Re: Problem clustering with multiple nodes

Posted by Troy Davidson <td...@cmcflex.com>.
Filip,

Thanks for the reply.  I started to look at the lb and make sure 
everything was ok there.  I did have a problem and everything is now 
working properly.

Filip Hanik - Dev Lists wrote:
> How do you "go to another server"?
> are you using a load balancer?
>
> ie, is your session cookie passed correctly when you switch server.
>
> Filip
>
>

-- 
++++++++++++++++++++++++++++++++++
Troy Davidson
Java Programmer
PC/Web Team

CMC/Flex
8520 South Sandy Parkway
Sandy, UT  84070
(801) 365-5000
www.cmcflex.com


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


Re: Problem clustering with multiple nodes

Posted by Filip Hanik - Dev Lists <de...@hanik.com>.
How do you "go to another server"?
are you using a load balancer?

ie, is your session cookie passed correctly when you switch server.

Filip


Troy Davidson wrote:
> I am trying to get a horizontal and vertical cluster working.  There 
> are three servers with two instances on Tomcat on each one.  The six 
> Tomcat instances are to share session data amongst themselves.  The 
> vertical clustering works fine.  I can log into the app on a server 
> and if I stay on that server, the session is replicated.
>
> But, as soon as I go to another server, the session is lost and I have 
> to re login.
>
> I see in the catalina.out that all the Tomcat instances are added:
>
> NFO: Replication member 
> added:org.apache.catalina.cluster.mcast.McastMember[tcp://10.9.100.2:4025,catalina,10.9.100.2,4025, 
> alive=3]
>
> There is an entry for each Tomcat that will be in the cluster.
>
> I can't find any problem with how things are setup, but obviously 
> there is a problem.   Here are the server.xml from two separate 
> Tomcat's on separate servers.  If someone in the know can take a look 
> and let me know if there is a problem, that would be great.  The 
> servers can see each other and communication is happening.
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> server.xml from Tomcat4 on server1:
>
> <Server port="14005" shutdown="SHUTDOWN">
>
>  <Listener className="org.apache.catalina.core.AprLifecycleListener" />
>  <Listener 
> className="org.apache.catalina.mbeans.ServerLifecycleListener" />
>  <Listener 
> className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" 
> />
>  <Listener 
> className="org.apache.catalina.storeconfig.StoreConfigLifecycleListener"/> 
>
>
>  <GlobalNamingResources>
>
>    <Environment name="simpleValue" type="java.lang.Integer" value="30"/>
>
>    <Resource name="UserDatabase" auth="Container"
>              type="org.apache.catalina.UserDatabase"
>       description="User database that can be updated and saved"
>           factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
>          pathname="conf/tomcat-users.xml" />
>
>  </GlobalNamingResources>
>
>  <Service name="Catalina">
>
>
>    <Connector port="14080" maxHttpHeaderSize="8192"
>               maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
>               enableLookups="false" redirectPort="14443" 
> acceptCount="100"
>               connectionTimeout="20000" disableUploadTimeout="true" />
>
>    <Connector port="14009"
>               enableLookups="false" redirectPort="14443" 
> protocol="AJP/1.3" />
>
>    <Engine name="Standalone" defaultHost="localhost" jvmRoute="jvm14">
>
>
>      <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
>             resourceName="UserDatabase"/>
>
>      <Host name="localhost" appBase="webapps"
>       unpackWARs="true" autoDeploy="true"
>       xmlValidation="false" xmlNamespaceAware="false">
>
>        <Cluster 
> className="org.apache.catalina.cluster.tcp.SimpleTcpCluster"
>                 
> managerClassName="org.apache.catalina.cluster.session.DeltaManager"
>                 expireSessionsOnShutdown="false"
>                 useDirtyFlag="false"
>                 notifyListenersOnReplication="true">
>
>            <Membership
>                className="org.apache.catalina.cluster.mcast.McastService"
>                mcastAddr="228.0.0.4"
>                mcastPort="45564"
>                mcastFrequency="500"
>                mcastDropTime="3000"/>
>
>            <Receiver
>                
> className="org.apache.catalina.cluster.tcp.ReplicationListener"
>                tcpListenAddress="10.9.100.1"
>                tcpListenPort="4014"
>                tcpSelectorTimeout="100"
>                tcpThreadCount="6"/>
>
>            <Sender
>                
> className="org.apache.catalina.cluster.tcp.ReplicationTransmitter"
>                replicationMode="pooled"
>                ackTimeout="15000"
>                waitForAck="true"/>
>
>            <Valve 
> className="org.apache.catalina.cluster.tcp.ReplicationValve"
>                   
> filter=".*\.gif;.*\.js;.*\.jpg;.*\.png;.*\.htm;.*\.html;.*\.css;.*\.txt;"/> 
>
>
>            <ClusterListener 
> className="org.apache.catalina.cluster.session.ClusterSessionListener"/>
>        </Cluster>
>
>    <Context path="" docBase="app" debug="0">
>    </Context>
>
>    <Context path="/app" docBase="app" debug="0">
>    </Context>
>      </Host>
>    </Engine>
>  </Service>
> </Server>
>
>
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> server.xml from Tomcat5 on server2:
>
> <Server port="25005" shutdown="SHUTDOWN">
>  <Listener className="org.apache.catalina.core.AprLifecycleListener" />
>  <Listener 
> className="org.apache.catalina.mbeans.ServerLifecycleListener" />
>  <Listener 
> className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" 
> />
>  <Listener 
> className="org.apache.catalina.storeconfig.StoreConfigLifecycleListener"/> 
>
>
>  <GlobalNamingResources>
>    <Environment name="simpleValue" type="java.lang.Integer" value="30"/>
>    <Resource name="UserDatabase" auth="Container"
>              type="org.apache.catalina.UserDatabase"
>       description="User database that can be updated and saved"
>           factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
>          pathname="conf/tomcat-users.xml" />
>  </GlobalNamingResources>
>  <Service name="Catalina">
>
>    <Connector port="25080" maxHttpHeaderSize="8192"
>               maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
>               enableLookups="false" redirectPort="25443" 
> acceptCount="100"
>               connectionTimeout="20000" disableUploadTimeout="true" />
>
>    <Connector port="25009" enableLookups="false" redirectPort="25443" 
> protocol="AJP/1.3" />
>    <Engine name="Standalone" defaultHost="localhost" jvmRoute="jvm25">
>      <Realm className="org.apache.catalina.realm.UserDatabaseRealm"  
> resourceName="UserDatabase"/>
>      <Host name="localhost" appBase="webapps"  unpackWARs="true" 
> autoDeploy="true"  xmlValidation="false" xmlNamespaceAware="false">
>
>        <Cluster 
> className="org.apache.catalina.cluster.tcp.SimpleTcpCluster"
>                 
> managerClassName="org.apache.catalina.cluster.session.DeltaManager"
>                 expireSessionsOnShutdown="false"
>                 useDirtyFlag="false"
>                 notifyListenersOnReplication="true">
>
>            <Membership
>                className="org.apache.catalina.cluster.mcast.McastService"
>                mcastAddr="228.0.0.4"
>                mcastPort="45564"
>                mcastFrequency="500"
>
>                mcastPort="45564"
>                mcastFrequency="500"
>                mcastDropTime="3000"/>
>
>            <Receiver
>                
> className="org.apache.catalina.cluster.tcp.ReplicationListener"
>                tcpListenAddress="10.9.100.2"
>                tcpListenPort="4025"
>                tcpSelectorTimeout="100"                 
> tcpThreadCount="6"/>
>            <Sender
>                
> className="org.apache.catalina.cluster.tcp.ReplicationTransmitter"
>                replicationMode="pooled"
>                ackTimeout="15000"
>                waitForAck="true"/>
>
>            <Valve 
> className="org.apache.catalina.cluster.tcp.ReplicationValve"
>                   
> filter=".*\.gif;.*\.js;.*\.jpg;.*\.png;.*\.htm;.*\.html;.*\.css;.*\.txt;"/> 
>
>
>            <ClusterListener 
> className="org.apache.catalina.cluster.session.ClusterSessionListener"/>
>        </Cluster>
>
>
>    <Context path="" docBase="app" debug="0">
>    </Context>
>
>    <Context path="/app" docBase="app" debug="0">
>    </Context>
>
>      </Host>
>
>    </Engine>
>
>  </Service>
>
> </Server>
>
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
>
>


-- 


Filip Hanik

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