tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ben short" <...@benshort.co.uk>
Subject Apache 2.2 + Tomcat 6 + Mod_JK 1.2.23 + Session Clustering
Date Mon, 18 Jun 2007 11:21:09 GMT
Hi All,

I'm trying to setup session clustering between two Tomcat 6.0.13
instances with Apache 2.2 and Mod JK 1.2.23.

The problem I'm having is that every request returns me a new session
so the users state is not kept, So i assume that the clustering is not
configured correctly.

Looking at the manager app on both tomcats i see the same number of
sessions, so they seem tobe replicated between the server.

Can anyone help me out please.


Here is my server.xml from tomcat 1

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

  <!--APR library loader. Documentation at /docs/apr.html -->
  <Listener className="org.apache.catalina.core.AprLifecycleListener"
SSLEngine="on" />
  <!--Initialize Jasper prior to webapps are loaded. Documentation at
/docs/jasper-howto.html -->
  <Listener className="org.apache.catalina.core.JasperListener" />
  <!-- JMX Support for the Tomcat server. Documentation at
/docs/non-existent.html -->
  <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" />
  <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"
/>

  <!-- Global JNDI resources -->
  <GlobalNamingResources>
    <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">

    <!-- Define an HTTP/1.1 Connector on port 8080 -->
    <Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />

    <!-- Define an AJP 1.3 Connector on port 8009 -->
    <Connector port="8009" protocol="AJP/1.3" redirectPort="8443"
	    address="192.168.6.174"
	    backlog="20"
	    connectionTimeout="0"
	    maxThreads="100"
	    tcpNoDelay="true" />

    <Engine name="Catalina" defaultHost="localhost" jvmRoute="jcpres1">

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

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


	<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
               prefix="access." suffix=".log" pattern="common"
resolveHosts="false"/>
	

	<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"
		channelSendOptions="4">			
			
		<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="26816"
                		frequency="500"
				dropTime="3000"/>
            	
			<Receiver className="org.apache.catalina.tribes.transport.nio.NioReceiver"
                		address="192.168.6.174"
                      		port="4000"
                      		autoBind="100"
                      		selectorTimeout="5000"
                      		maxThreads="6"/>

            		<Sender
className="org.apache.catalina.tribes.transport.ReplicationTransmitter">
				<Transport className="org.apache.catalina.tribes.transport.nio.PooledParallelSender"
					timeout="3000"/>
            		</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=".*\.gif;.*\.js;.*\.jpg;.*\.png;.*\.htm;.*\.html;.*\.css;.*\.txt;"/>
	
		<Valve className="org.apache.catalina.ha.session.JvmRouteBinderValve"/>

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

	</Cluster>
	
      </Host>
    </Engine>
  </Service>
</Server>


Tomcat 2's server.xml

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

  <!--APR library loader. Documentation at /docs/apr.html -->
  <Listener className="org.apache.catalina.core.AprLifecycleListener"
SSLEngine="on" />
  <!--Initialize Jasper prior to webapps are loaded. Documentation at
/docs/jasper-howto.html -->
  <Listener className="org.apache.catalina.core.JasperListener" />
  <!-- JMX Support for the Tomcat server. Documentation at
/docs/non-existent.html -->
  <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" />
  <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"
/>

  <!-- Global JNDI resources -->
  <GlobalNamingResources>
    <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">

    <!-- Define an HTTP/1.1 Connector on port 8080 -->
    <Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />

    <!-- Define an AJP 1.3 Connector on port 8009 -->
    <Connector port="8009" protocol="AJP/1.3" redirectPort="8443"
	    address="192.168.6.174"
	    backlog="20"
	    connectionTimeout="0"
	    maxThreads="100"
	    tcpNoDelay="true" />

    <Engine name="Catalina" defaultHost="localhost" jvmRoute="jcpres2">

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

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


	<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
               prefix="access." suffix=".log" pattern="common"
resolveHosts="false"/>
	

	<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"
		channelSendOptions="4">			
			
		<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="26816"
                		frequency="500"
				dropTime="3000"/>
            	
			<Receiver className="org.apache.catalina.tribes.transport.nio.NioReceiver"
                		address="192.168.6.174"
                      		port="4000"
                      		autoBind="100"
                      		selectorTimeout="5000"
                      		maxThreads="6"/>

            		<Sender
className="org.apache.catalina.tribes.transport.ReplicationTransmitter">
				<Transport className="org.apache.catalina.tribes.transport.nio.PooledParallelSender"
					timeout="3000"/>
            		</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=".*\.gif;.*\.js;.*\.jpg;.*\.png;.*\.htm;.*\.html;.*\.css;.*\.txt;"/>
	
		<Valve className="org.apache.catalina.ha.session.JvmRouteBinderValve"/>

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

	</Cluster>
	
      </Host>
    </Engine>
  </Service>
</Server>

And my workers.properties..


# For full details abotu configuration options please visit
# http://tomcat.apache.org/connectors-doc/reference/workers.html

# JK Status worker config

worker.list=jkstatus
worker.jkstatus.type=status

# Presentaton Load Balancer Config

worker.list=preslb

worker.preslb.type=lb
worker.preslb.balance_workers=jcpres1,jcpres2
worker.preslb.sticky_session=1

worker.jcpres1.port=8009
worker.jcpres1.host=192.168.6.174
worker.jcpres1.type=ajp13
worker.jcpres1.lbfactor=1
worker.jcpres1.fail_on_status=404,503

worker.jcpres2.port=8009
worker.jcpres2.host=192.168.6.171
worker.jcpres2.type=ajp13
worker.jcpres2.lbfactor=1
worker.jcpres2.fail_on_status=404,503

# Core Load Balancer Config

worker.list=corelb

worker.corelb.type=lb
worker.corelb.balance_workers=worker3
worker.corelb.sticky_session=0

worker.worker3.port=8010
worker.worker3.host=192.168.6.103
worker.worker3.type=ajp13
worker.worker3.lbfactor=1
worker.worker3.fail_on_status=404,503

---------------------------------------------------------------------
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


Mime
View raw message