tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pid...@pidster.com>
Subject Re: Tomcat session replication/cluster (mod_proxy_ajp)
Date Mon, 26 Jun 2006 10:42:58 GMT
(I've manually configured the tcpListenAddress to be the node's main IP.
Obviously it's not 000.000.000.00.)
I've specified JvmRouteBinderValve, JvmRouteSessionIDBinderListener and
ClusterSessionListener.


<Cluster className="org.apache.catalina.cluster.tcp.SimpleTcpCluster"

managerClassName="org.apache.catalina.cluster.session.DeltaManager"
                 clusterName="ServerCluster01"
                 expireSessionsOnShutdown="false"
                 useDirtyFlag="true"
                 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="000.000.000.000"
                tcpListenPort="4001"
                tcpSelectorTimeout="100"
                tcpThreadCount="6"/>
            <Sender

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

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

<Valve
className="org.apache.catalina.cluster.session.JvmRouteBinderValve"
enabled="true"/>
<ClusterListener
className="org.apache.catalina.cluster.session.JvmRouteSessionIDBinderListener"/>
<ClusterListener
className="org.apache.catalina.cluster.session.ClusterSessionListener" />

</Cluster>



Sean O'Reilly wrote:
> On Fri, 23 Jun 2006 16:43:16 +0100
> Pid <p@pidster.com> wrote:
> 
>>
>> Sean O'Reilly wrote:
>>> On Fri, 23 Jun 2006 09:05:18 -0500
>>> Filip Hanik - Dev Lists <devlists@hanik.com> wrote:
>>> I am sure it would be easier to use mod_proxy_balancer and
>>> mod_proxy_ajp but can't find any documentation anywhere.
>> My servers didn't have their clocks synchronised, check that.
>> Also try using the most basic cluster config to start with and work up
>> to more complex variations.
>>
>> There's not much to configure for proxy_ajp / balancer.
>> We're running Apache2.2 + Tomcat 5.5.17 + with mod_proxy_ajp &c.
>> AJP needs no config, which is nice.
>> Balancer also needs very little, see mod_proxy for details.
>> The route=TCS1 parameter is the jvmRoute set in the tomcat Engine.
>>
>> ### put this in your Apache vhost/conf
>>
>> ReWriteEngine     on
>> ProxyPreserveHost On
>> ProxyRequests     Off
>> ProxyVia          Off
>>
>> <Proxy balancer://mycluster>
>>    BalancerMember ajp://tomcat1:8009 smax=10 loadfactor=10 route=TCS1
>>    BalancerMember ajp://tomcat2:8009 smax=10 loadfactor=10 route=TCS2
>> </Proxy>
>>
>> RewriteRule ^\/(.+)\.jsp(.+)? balancer://mycluster/$1.jsp$2 [P,L]
>>
>> ProxyPass /favicon.ico !
>> ProxyPass /robots.txt  !
>> ProxyPass /images/     !
>> ProxyPass /forms/ balancer://mycluster/forms/ \
>> maxattempts=1 lbmethod=bytraffic stickysession=JSESSIONID
>>
>>
>>
>>
>>> Thanks for the help so far guys.
>>>
>> ---------------------------------------------------------------------
>> 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
> ok here are latest config files
> 
> server.xml (cluster configuration)
> 
> <Cluster className="org.apache.catalina.cluster.tcp.SimpleTcpCluster"
>                 name="cluster"
>                 debug="10"
>                 serviceclass="org.apache.catalina.cluster.mcast.McastService"
>                 mcastAddress="228.0.0.4"
>                 mcastPort="45564"                 
> 		mcastFrequency="500"
>                 mcastDroptime="3000"
>                 tcpThreadCount="6"
>                 tcpListenAddress="auto"
>                 tcpListenPort="4001"
>                 tcpSelectorTimeout="100"
>                 printToScreen="false"
>                 expireSessionsOnShutdown="false"
>                 useDirtyFlag="true"
>                 replicationMode="synchronous"/>
> 
> <Valve className="org.apache.catalina.cluster.tcp.ReplicationValve"
>                    filter=".*\.gif;.*\.js;.*\.jpg;.*\.png;.*\.htm;.*\.html;.*\.css;.*\.txt;"/>
> ###################################################################################################
> connector.conf
> 
> ReWriteEngine   On
> ProxyPreserveHost       On
> ProxyRequests   Off
> ProxyVia        Off
> 
> <Proxy balancer://secpay_cluster>
>         BalancerMember ajp://localhost:8009 smax=10 loadfactor=1
> route=jvm1
>         BalancerMember ajp://192.168.4.3:8009 smax=10 loadfactor=1
> route=jvm2
>         BalancerMember ajp://192.168.4.1:8009 smax=10 loadfactor=1
> route=jvm3
> </proxy>
> 
> RewriteRule ^\/(.+)\.jsp(.+)? balancer://secpay_cluster/$1.jsp$2 [P,L]
> 
> ProxyPass /favicon.ico !
> ProxyPass /robots.txt  !
> ProxyPass /images/     !
> ProxyPass /jsp-examples/*       balancer://secpay_cluster/jsp-examples/
> maxattempts=1 lbmethod=byrequests nofailover=off
> stickysession=JSESSIONID
> ProxyPassReverse /jsp-example/* balancer://secpay_cluster/jsp-examples/
> maxattempts=1 lbmethod=byrequests nofailover=off
> stickysession=JSESSIONID
> ProxyPass /servlets-examples/*
> balancer://secpay_cluster/servlets-examples/ maxattempts=1
> lbmethod=byrequests nofailover=off stickysession=JSESSIONID
> ProxyPassReverse /servlets-examples/*
> balancer://secpay_cluster/servlets-examples/ maxattempts=1
> lbmethod=byrequests nofailover=off stickysession=JSESSIONID
> 
> ##############################################################################
> startup logs from one of the servers
> 
> 26-Jun-2006 11:13:45 org.apache.catalina.cluster.tcp.SimpleTcpCluster
> createDefaultClusterListener
> INFO: Add Default ClusterListener at cluster localhost
> 26-Jun-2006 11:13:45 org.apache.catalina.cluster.tcp.SimpleTcpCluster
> createDefaultClusterReceiver
> INFO: Add Default ClusterReceiver at cluster localhost
> 26-Jun-2006 11:13:45 org.apache.catalina.cluster.tcp.SimpleTcpCluster
> createDefaultClusterSender
> INFO: Add Default ClusterSender at cluster localhost
> 26-Jun-2006 11:13:45
> org.apache.catalina.cluster.tcp.SocketReplicationListener
> createServerSocket
> INFO: Open Socket at [127.0.0.1:8015]
> 26-Jun-2006 11:13:45
> org.apache.catalina.cluster.tcp.ReplicationTransmitter start
> INFO: Start ClusterSender at cluster
> Standalone:type=Cluster,host=localhost with name
> Standalone:type=ClusterSender,host=localhost
> 26-Jun-2006 11:13:45 org.apache.catalina.cluster.tcp.SimpleTcpCluster
> createDefaultMembershipService
> INFO: Add Default Membership Service at cluster localhost
> 26-Jun-2006 11:13:45 org.apache.catalina.cluster.mcast.McastService
> start
> INFO: Sleeping for 4000 milliseconds to establish cluster membership
> 26-Jun-2006 11:13:46 org.apache.catalina.cluster.tcp.SimpleTcpCluster
> memberAdded
> INFO: Replication member
> added:org.apache.catalina.cluster.mcast.McastMember[tcp://192.168.4.121:8015,catalina,192.168.4.121,8015,
> alive=154886]
> 26-Jun-2006 11:13:46
> org.apache.catalina.cluster.tcp.FastAsyncSocketSender checkThread
> INFO: Create sender [/192.168.4.121:8,015] queue thread to tcp
> background replication
> 26-Jun-2006 11:13:49 org.apache.catalina.cluster.mcast.McastService
> registerMBean
> INFO: membership mbean registered
> (Standalone:type=ClusterMembership,host=localhost)
> 26-Jun-2006 11:13:51 org.apache.catalina.core.ApplicationContext log
> INFO: org.apache.webapp.balancer.BalancerFilter: init(): ruleChain:
> [org.apache.webapp.balancer.RuleChain:
> [org.apache.webapp.balancer.rules.URLStringMatchRule: Target string: News / Redirect
URL: http://www.cnn.com], [org.apache.webapp.balancer.rules.RequestParameterRule: Target param
name: paramName / Target param value: paramValue / Redirect URL: http://www.yahoo.com], [org.apache.webapp.balancer.rules.AcceptEverythingRule:
Redirect URL: http://jakarta.apache.org]]
> 26-Jun-2006 11:13:51 org.apache.catalina.cluster.session.DeltaManager
> start
> INFO: Register manager /jsp-examples to cluster element Host with name
> localhost
> 26-Jun-2006 11:13:51 org.apache.catalina.cluster.session.DeltaManager
> start
> INFO: Starting clustering manager at /jsp-examples
> 26-Jun-2006 11:13:51 org.apache.catalina.cluster.session.DeltaManager
> getAllClusterSessions
> WARNING: Manager [/jsp-examples], requesting session state from
> org.apache.catalina.cluster.mcast.McastMember[tcp://192.168.4.121:8015,catalina,192.168.4.121,8015,
> alive=159907]. This operation will timeout if no session state has been received within
60 seconds.
> 26-Jun-2006 11:14:51 org.apache.catalina.cluster.session.DeltaManager
> waitForSendAllSessions
> SEVERE: Manager [/jsp-examples]: No session state send at 26/06/06
> 11:13 received, timing out after 60,137 ms.
> 26-Jun-2006 11:14:51 org.apache.catalina.core.ApplicationContext log
> INFO: ContextListener: contextInitialized()
> 26-Jun-2006 11:14:51 org.apache.catalina.core.ApplicationContext log
> INFO: SessionListener: contextInitialized()
> 26-Jun-2006 11:14:52 org.apache.catalina.core.ApplicationContext log
> INFO: ContextListener: contextInitialized()
> 26-Jun-2006 11:14:52 org.apache.catalina.core.ApplicationContext log
> INFO: SessionListener: contextInitialized()
> 26-Jun-2006 11:14:52 org.apache.jk.common.ChannelSocket init
> INFO: JK: ajp13 listening on /0.0.0.0:8009
> 26-Jun-2006 11:14:52 org.apache.jk.server.JkMain start
> INFO: Jk running ID=0 time=0/144  config=null
> 26-Jun-2006 11:14:53 org.apache.catalina.storeconfig.StoreLoader load
> INFO: Find registry server-registry.xml at classpath resource
> 26-Jun-2006 11:14:53 org.apache.catalina.startup.Catalina start
> INFO: Server startup in 68534 ms
> 26-Jun-2006 11:19:57 org.apache.catalina.cluster.tcp.SimpleTcpCluster
> memberDisappeared
> INFO: Received member
> disappeared:org.apache.catalina.cluster.mcast.McastMember[tcp://192.168.4.121:8015,catalina,192.168.4.121,8015,
> alive=495495]
> 26-Jun-2006 11:19:57 org.apache.catalina.cluster.util.FastQueue remove
> INFO: FastQueue.remove: Remove aborted although queue enabled
> 
> 
> Still having some problems with load balancing and state replication
> neither of which appear to be working. If i shutdown tomcat on the
> main server i can still get to the application directory from one of
> the other servers but get a 503 error if i try to run  any of the
> applications ?? 
> 
> 
> 
> 

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