You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@geronimo.apache.org by Jeff Genender <jg...@savoirtech.com> on 2005/11/14 22:16:31 UTC

[LONG]Tomcat clustering enabling GBeans howto - Part 3

Complex Clustering GBeans
-------------------------

In the last 2 parts I explained how to set up simple clustering with a 
single class for Engine/Host/Context levels.  Now we can expand on this 
for more complex settings.  The following are the Clustering Gbeans that 
have been created:

CatalinaClusterGBean - The main clustering bean

ClusterDeployerGBean - Should normally not be used directly..should be 
extended...although it could be used for simple deployers.

FarmWarDeployerGBean - In theory this will work, but may be an issue 
with Geronimo deployments.

MembershipServiceGBean - Membership wrapper

MessageListenerGBean - This can be chained like a ValveGBean

ReceiverGBean - Receiver wrapper

SenderGBean - Sender wrapper

All of these Gbeans work just like most of the other Tomcat GBeans, 
where you set the initParams attribute to a listing of all of the Tomcat 
settings that are used (Except for the FarmWarDeployer which uses GBean 
attributes).  The following is the same example as the Tomcat complex 
clustering  from the 
http://tomcat.apache.org/tomcat-5.5-doc/cluster-howto.html page but with 
GBeans:

<!-- Cluster -->
<gbean name="TomcatCluster"
        class="org.apache.geronimo.tomcat.cluster.CatalinaClusterGBean">
   <attribute 
name="className">org.apache.catalina.cluster.tcp.SimpleTcpCluster</attribute>
   <attribute name="initParams">
     doClusterLog=true
     clusterLogName=clusterlog
     manager.className=org.apache.catalina.cluster.session.DeltaManager
     manager.expireSessionsOnShutdown=false
     manager.notifyListenersOnReplication=false
     manager.notifySessionListenersOnReplication=false
     manager.sendAllSessions=false
     manager.sendAllSessionsSize=500
     manager.sendAllSessionsWaitTime=20
   </attribute>
   <attribute name="Membership">TomcatMembership</attribute>
   <attribute name="Receiver>TomcatReceiver</attribute>
   <attribute name="Sender>TomcatSender</attribute>
   <attribute
        name="MessageListenerChain>ClusterSessionListener</attribute>
   <attribute name="TomcatValveChain>ReplicationValve</attribute>
   <attribute name="ClusterDeployer>FarmWarDeployer</attribute>
</gbean>

<!-- Membership -->
<gbean name="TomcatMembership"
       class="org.apache.geronimo.tomcat.cluster.MembershipServiceGBean">
   <attribute 
name="className">org.apache.catalina.cluster.mcast.McastService</attribute>
   <attribute name="initParams">
     mcastAddr=228.0.0.4
     mcastBindAddress=127.0.0.1
     mcastClusterDomain=d10
     mcastPort=45564
     mcastFrequency=1000
     mcastDropTime=30000
   </attribute>
</gbean>

<!-- Receiver -->
<gbean name="TomcatReceiver"
       class="org.apache.geronimo.tomcat.cluster.ReceiverGBean">
   <attribute 
name="className">org.apache.catalina.cluster.tcp.ReplicationListener</attribute>
   <attribute name="initParams">
     tcpListenAddress=auto
     tcpListenPort=9015
     tcpSelectorTimeout=100
     tcpThreadCount=6
   </attribute>
</gbean>

<!-- Sender -->
<gbean name="TomcatSender"
       class="org.apache.geronimo.tomcat.cluster.SenderGBean">
   <attribute 
name="className">org.apache.catalina.cluster.tcp.ReplicationTransmitter</attribute>
   <attribute name="initParams">
     replicationMode=fastasyncqueue
     doTransmitterProcessingStats=true
     doProcessingStats=true
     doWaitAckStats=true
     queueTimeWait=true
     queueDoStats=true
     queueCheckLock=true
     ackTimeout=15000
     waitForAck=true
     keepAliveTimeout=80000
     keepAliveMaxRequestCount=-1
   </attribute>
</gbean>

<!-- Valves -->
<gbean name="ReplicationValve"
        class="org.apache.geronimo.tomcat.ValveGBean">
    <attribute
name="className">org.apache.catalina.cluster.tcp.ReplicationValve</attribute>
    <attribute name="initParams">
filter=.*\.gif;.*\.js;.*\.css;.*\.png;.*\.jpeg;.*\.jpg;.*\.htm;.*\.html;.*\.txt;
      primaryIndicator=true
     </attribute>
     <reference name="NextValve">
       <moduleType>J2EEModule</moduleType>
       <name>JvmRouteBinderValve</name>
     </reference>
</gbean>

<gbean name="JvmRouteBinderValve"
        class="org.apache.geronimo.tomcat.ValveGBean">
    <attribute
name="className">org.apache.catalina.cluster.session.JvmRouteBinderValve</attribute>
    <attribute name="initParams">
      enabled=true
    </attribute>
</gbean>

<!-- Listeners -->
<gbean name="ClusterSessionListener"
        class="org.apache.geronimo.tomcat.cluster.MessageListenerGBean">
    <attribute
name="className">org.apache.catalina.cluster.session.ClusterSessionListener</attribute>
    <reference name="NextListener">
       <moduleType>J2EEModule</moduleType>
       <name>JvmRouteSessionIDBinderListener</name>
    </reference>
</gbean>

<gbean name="JvmRouteSessionIDBinderListener"
        class="org.apache.geronimo.tomcat.cluster.MessageListenerGBean">
    <attribute
name="className">org.apache.catalina.cluster.session.JvmRouteSessionIDBinderListener</attribute>
</gbean>

<!-- Deployer -->
<gbean name="FarmWarDeployer"
        class="org.apache.geronimo.tomcat.cluster.FarmWarDeployerGBean">
    <attribute name="tempDir">var/catalina/war-temp</attribute>
    <attribute name="deployDir">var/catalina/war-deploy</attribute>
    <attribute name="watchDir">var/catalina/war-listen</attribute>
    <attribute name="watchEnabled">true</attribute>
    <attribute name="processDeployFrequency">10</attribute>
    <reference name="ServerInfo">
        <module>org/apache/geronimo/System</module>
        <name>ServerInfo</name>
     </reference>
</gbean>