Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • Use ReceiverGBean to specify the information of the current node and port number used for communication.
  • Use ChannelInterceptorGBeans to disable the multicast cluster configurations and specify how the static member are chained together as you can see the configurations of StaticMember1Interceptor and StaticMember2Interceptor, and disable the multicast cluster configurations.
  • Use StaticMemberGBean to specify the information of the second static member and port number used for communication.

To convert this example to a multicast configuration, the DisableMCastInterceptor, StaticMemberInterceptor, and StaticMember definitions need to be removed. Also, the value for the " address " attribute for the TomcatReceiver definition should be changed to " auto".

Code Block
XML
XML
borderStylesolid
titleexcerpt from geronimo-web.xml
...
    <cluster>TomcatCluster</cluster>
        <gbean name="TomcatCluster" class="org.apache.geronimo.tomcat.cluster.CatalinaClusterGBean">
            <attribute name="className">org.apache.catalina.ha.tcp.SimpleTcpCluster</attribute>
            <attribute name="initParams"/>
            <reference name="ClusterListenerChain"> 
                    <name>TomcatClusterListenerChain</name>
            </reference>
            <reference name="TomcatValveChain">
                    <name>ReplicationValve</name>  
            </reference>
            <reference name="Channel">
                    <name>TomcatChannel</name>
            </reference>
            <reference name="ClusterManager"> 
                    <name>TomcatClusterManager</name>
            </reference>
        </gbean>

        <gbean name="TomcatClusterListenerChain" class="org.apache.geronimo.tomcat.cluster.ClusterListenerGBean">
            <attribute name="className">org.apache.catalina.ha.session.ClusterSessionListener</attribute>
            <attribute name="initParams"/>
        </gbean>

        <gbean name="ReplicationValve" class="org.apache.geronimo.tomcat.ValveGBean">
            <attribute name="className">org.apache.catalina.ha.tcp.ReplicationValve</attribute>
            <attribute name="initParams">.*\.gif;.*\.js;.*\.jpg;.*\.png;.*\.htm;.*\.html;.*\.css;.*\.txt;</attribute>
            <reference name="NextValve">
        			<type>TomcatValve</type>
            	                <name>JvmRouteBinderValve</name>
            </reference>
        </gbean>

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

        <gbean name="TomcatClusterManager" class="org.apache.geronimo.tomcat.cluster.ClusterManagerGBean">
            <attribute name="className">org.apache.catalina.ha.session.DeltaManager</attribute>
            <attribute name="initParams">name=${clusterName}
                                         channelSendOptions=6
                                         expireSessionsOnShutdown=false
                                         notifyListenersOnReplication=true
                                         mapSendOptions=6
            </attribute>
        </gbean>

        <gbean name="TomcatChannel" class="org.apache.geronimo.tomcat.cluster.ChannelGBean">
            <attribute name="className">org.apache.catalina.tribes.group.GroupChannel</attribute>
            <attribute name="initParams"/>
            <reference name="Membership"> 
                    <name>ClusterMembership</name>
            </reference>
            <reference name="Receiver">
                    <name>ClusterReceiver</name>                
            </reference>
            <reference name="Sender">                
                    <name>ClusterSender</name>
            </reference>
            <reference name="ChannelInterceptor">
                    <name>DisableMcastInterceptor</name>                
            </reference>
        </gbean>

        <gbean name="ClusterMembership" class="org.apache.geronimo.tomcat.cluster.MembershipServiceGBean">
            <attribute name="className">org.apache.catalina.tribes.membership.McastService</attribute>
            <attribute name="initParams">address=228.0.0.4
                                         port=45564
                                         frequency=500
                                         dropTime=3000
            </attribute>
        </gbean>

        <gbean name="ClusterReceiver" class="org.apache.geronimo.tomcat.cluster.ReceiverGBean">
            <attribute name="className">org.apache.catalina.tribes.transport.nio.NioReceiver</attribute>
            <attribute name="initParams">address=IPAddress1
                                         port=TCP_port1
                                         selectorTimeout=100
                                         maxThreads=6
            </attribute>
        </gbean>

        <gbean name="ClusterSender" class="org.apache.geronimo.tomcat.cluster.SenderGBean">
            <attribute name="className">org.apache.catalina.tribes.transport.ReplicationTransmitter</attribute>
        </gbean>

        <gbean name="DisableMcastInterceptor" class="org.apache.geronimo.tomcat.cluster.ChannelInterceptorGBean">
            <attribute name="className">org.apache.geronimo.tomcat.interceptor.DisableMcastInterceptor</attribute>
            <attribute name="initParams"/>
            <reference name="NextInterceptor">
                    <name>TcpPingInterceptor</name>                
            </reference>
        </gbean>

        <gbean name="TcpPingInterceptor" class="org.apache.geronimo.tomcat.cluster.ChannelInterceptorGBean">
            <attribute name="className">org.apache.catalina.tribes.group.interceptors.TcpPingInterceptor</attribute>
            <attribute name="initParams">Interval=240</attribute>
            <reference name="NextInterceptor">
                    <name>TcpFailureDetector</name>                
            </reference>
        </gbean>

        <gbean name="TcpFailureDetector" class="org.apache.geronimo.tomcat.cluster.ChannelInterceptorGBean">
            <attribute name="className">org.apache.catalina.tribes.group.interceptors.TcpFailureDetector</attribute>
            <attribute name="initParams"/>
            <reference name="NextInterceptor">                
                    <name>StaticMember1Interceptor</name>                
            </reference>
        </gbean>

        <gbean name="StaticMember1Interceptor" class="org.apache.geronimo.tomcat.cluster.ChannelInterceptorGBean">
            <attribute name="className">org.apache.catalina.tribes.group.interceptors.StaticMembershipInterceptor</attribute>
            <attribute name="initParams"/>
            <reference name="StaticMember">
                    <name>StaticMember2</name>                
            </reference>
            <reference name="NextInterceptor">                
                    <name>MessageDispatch15Interceptor</name> 
            </reference>
        </gbean>

        <gbean name="MessageDispatch15Interceptor" class="org.apache.geronimo.tomcat.cluster.ChannelInterceptorGBean">
            <attribute name="className">org.apache.catalina.tribes.group.interceptors.MessageDispatch15Interceptor</attribute>
            <attribute name="initParams"/>
            <reference name="NextInterceptor">
                    <name>ThroughputInterceptor</name>                
            </reference>
        </gbean>

        <gbean name="ThroughputInterceptor" class="org.apache.geronimo.tomcat.cluster.ChannelInterceptorGBean">
            <attribute name="className">org.apache.catalina.tribes.group.interceptors.ThroughputInterceptor</attribute>
            <attribute name="initParams"/>
        </gbean>

        <gbean name="StaticMember2" class="org.apache.geronimo.tomcat.cluster.StaticMemberGBean">
            <attribute name="className">org.apache.catalina.tribes.membership.StaticMember</attribute>
            <attribute name="initParams">port=TCP_port2
                                         securePort=-1
                                         host=IPAddress2
                                         domain=test-domain
                                         UniqueId={2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
            </attribute>
        </gbean>
...

...

Interceptors can perform actions when a message is sent or received. Use a reference NextInterceptor in interceptor configurations to chain interceptors together. You can control how the client requests are processed by arranging the order of the interceptor chain. In the following sample code, when the TcpFailureDetector intercepter catches errors, it calls the next interceptor StaticMember1Interceptor. The static member referenced inside StaticMember1Interceptor, static member 2 in this example, will immediately take over the work of the first static member.

Code Block
XML
XML
borderStylesolid
titleinterceptor chain
...
<gbean name="TcpFailureDetector" class="org.apache.geronimo.tomcat.cluster.ChannelInterceptorGBean">
 	 <attribute name="className">org.apache.catalina.tribes.group.interceptors.TcpFailureDetector</attribute>
 	 <attribute name="initParams"/>
 	 <reference name="NextInterceptor">
 	 <name>StaticMember1Interceptor</name>
 	 </reference>
 	 </gbean>
 	 
 	 <gbean name="StaticMember1Interceptor" class="org.apache.geronimo.tomcat.cluster.ChannelInterceptorGBean">
 	 <attribute name="className">org.apache.catalina.tribes.group.interceptors.StaticMembershipInterceptor</attribute>
 	 <attribute name="initParams"/>
 	 <reference name="StaticMember">
 	 <name>StaticMember2</name>
 	 </reference>
 	 <reference name="NextInterceptor">
 	 <name>MessageDispatch15Interceptor</name>
 	 </reference>
 	 </gbean>
...

All the static members involved should be defined in the deployment plan as well as the relationship between these static members. Use a reference NextStaticMember in the second and subsequent StaticMember definitions, but not definition of each static member, except for the last one, to chain multiple static members together. When static member 2 in this example fails to take over the work, static member 3 will immediately take over the work. It is the same for longer static member chain. When a static member fails to take over the work of the previous static member, it calls the next static member in the chain, until a static member can handle the work or it gets to the end.

Code Block
XML
XML
borderStylesolid
titlestatic member chain
...
<gbean name="StaticMember2" class="org.apache.geronimo.tomcat.cluster.StaticMemberGBean">
	  	 <attribute name="className">org.apache.catalina.tribes.membership.StaticMember</attribute>
	  	 <attribute name="initParams">port=TCP_port2
	  	 securePort=-1
	  	 host=IPAddress2
	  	 domain=test-domain
	  	 UniqueId={2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
	  	 </attribute>
	  	         <reference name="NextStaticMember">
	 	  	 <name>StaticMember3</name>
	  	         </reference>
</gbean> 
...

See the following deployment plan snippet as an complete example of setting up application-scoped unicast clustering with more than two nodes. There are three nodes in this example. When the TcpFailureDetector intercepter catches errors, it calls the next interceptor in the chain StaticMember1Interceptor. The static member referenced inside StaticMember1Interceptor will immediately take over the work of the first static member.

Code Block
XML
XML
borderStylesolid
titleexcerpt from geronimo-web.xml
...
 	 <cluster>TomcatCluster</cluster>
 	 <gbean name="TomcatCluster" class="org.apache.geronimo.tomcat.cluster.CatalinaClusterGBean">
 	 <attribute name="className">org.apache.catalina.ha.tcp.SimpleTcpCluster</attribute>
 	 <attribute name="initParams">managerClassName=org.apache.catalina.ha.session.DeltaManager
 	 expireSessionsOnShutdown=false
 	 useDirtyFlag=true
 	 notifyListenersOnReplication=true
 	 </attribute>
 	 <reference name="ClusterListenerChain">
 	 <name>TomcatClusterListenerChain</name>
 	 </reference>
 	 <reference name="TomcatValveChain">
 	 <name>ReplicationValve</name>
 	 </reference>
 	 <reference name="Channel">
 	 <name>TomcatChannel</name>
 	 </reference>
 	 </gbean>
 	 
 	 <gbean name="TomcatClusterListenerChain" class="org.apache.geronimo.tomcat.cluster.ClusterListenerGBean">
 	 <attribute name="className">org.apache.catalina.ha.session.ClusterSessionListener</attribute>
 	 <attribute name="initParams"/>
 	 </gbean>
 	 
 	 <gbean name="ReplicationValve" class="org.apache.geronimo.tomcat.ValveGBean">
 	 <attribute name="className">org.apache.catalina.ha.tcp.ReplicationValve</attribute>
 	 <attribute name="initParams">.*\.gif;.*\.js;.*\.jpg;.*\.png;.*\.htm;.*\.html;.*\.css;.*\.txt;</attribute>
 	 <reference name="NextValve">
 	 <type>TomcatValve</type>
 	 <name>JvmRouteBinderValve</name>
 	 </reference>
 	 </gbean>
 	 
 	 <gbean name="JvmRouteBinderValve" class="org.apache.geronimo.tomcat.ValveGBean">
 	 <attribute name="className">org.apache.catalina.ha.session.JvmRouteBinderValve</attribute>
 	 <attribute name="initParams">enabled=true</attribute>
 	 </gbean>
 	 
 	 <gbean name="TomcatChannel" class="org.apache.geronimo.tomcat.cluster.ChannelGBean">
 	 <attribute name="className">org.apache.catalina.tribes.group.GroupChannel</attribute>
 	 <attribute name="initParams"/>
 	 <reference name="Membership">
 	 <name>ClusterMembership</name>
 	 </reference>
 	 <reference name="Receiver">
 	 <name>ClusterReceiver</name>
 	 </reference>
 	 <reference name="Sender">
 	 <name>ClusterSender</name>
 	 </reference>
 	 <reference name="ChannelInterceptor">
 	 <name>DisableMcastInterceptor</name>
 	 </reference>
 	 </gbean>
 	 
 	 <gbean name="ClusterMembership" class="org.apache.geronimo.tomcat.cluster.MembershipServiceGBean">
 	 <attribute name="className">org.apache.catalina.tribes.membership.McastService</attribute>
 	 <attribute name="initParams">address=228.0.0.4
 	 port=45564
 	 frequency=500
 	 dropTime=3000
 	 </attribute>
 	 </gbean>

 	 <gbean name="ClusterReceiver" class="org.apache.geronimo.tomcat.cluster.ReceiverGBean">
 	 <attribute name="className">org.apache.catalina.tribes.transport.nio.NioReceiver</attribute>
 	 <attribute name="initParams">address=IPAddress1
 	 port=10200
 	 selectorTimeout=100
 	 maxThreads=6
 	 </attribute>
 	 </gbean>
 	 
	 
 	 <gbean name="ClusterSender" class="org.apache.geronimo.tomcat.cluster.SenderGBean">
 	 <attribute name="className">org.apache.catalina.tribes.transport.ReplicationTransmitter</attribute>
 	 </gbean>
 	 
 	 <gbean name="DisableMcastInterceptor" class="org.apache.geronimo.tomcat.cluster.ChannelInterceptorGBean">
 	 <attribute name="className">org.apache.geronimo.tomcat.interceptor.DisableMcastInterceptor</attribute>
 	 <attribute name="initParams"/>
 	 <reference name="NextInterceptor">
 	 <name>TcpPingInterceptor</name>
 	 </reference>
 	 </gbean>
 	 
 	 <gbean name="TcpPingInterceptor" class="org.apache.geronimo.tomcat.cluster.ChannelInterceptorGBean">
 	 <attribute name="className">org.apache.catalina.tribes.group.interceptors.TcpPingInterceptor</attribute>
 	 <attribute name="initParams">Interval=240</attribute>
 	 <reference name="NextInterceptor">
 	 <name>TcpFailureDetector</name>
 	 </reference>
 	 </gbean>
 	 
 	 <gbean name="TcpFailureDetector" class="org.apache.geronimo.tomcat.cluster.ChannelInterceptorGBean">
 	 <attribute name="className">org.apache.catalina.tribes.group.interceptors.TcpFailureDetector</attribute>
 	 <attribute name="initParams"/>
 	 <reference name="NextInterceptor">
 	 <name>StaticMember1Interceptor</name>
 	 </reference>
 	 </gbean>
 	 
 	 <gbean name="StaticMember1Interceptor" class="org.apache.geronimo.tomcat.cluster.ChannelInterceptorGBean">
 	 <attribute name="className">org.apache.catalina.tribes.group.interceptors.StaticMembershipInterceptor</attribute>
 	 <attribute name="initParams"/>
 	 <reference name="StaticMember">
 	 <name>StaticMember2</name>
 	 </reference>
 	 <reference name="NextInterceptor">
 	 <name>MessageDispatch15Interceptor</name>
 	 </reference>
 	 </gbean>
 	 
 	 <gbean name="MessageDispatch15Interceptor" class="org.apache.geronimo.tomcat.cluster.ChannelInterceptorGBean">
 	 <attribute name="className">org.apache.catalina.tribes.group.interceptors.MessageDispatch15Interceptor</attribute>
 	 <attribute name="initParams"/>
 	 <reference name="NextInterceptor">
 	 <name>ThroughputInterceptor</name>
 	 </reference>
 	 </gbean>
 	 
 	 <gbean name="ThroughputInterceptor" class="org.apache.geronimo.tomcat.cluster.ChannelInterceptorGBean">
 	 <attribute name="className">org.apache.catalina.tribes.group.interceptors.ThroughputInterceptor</attribute>
 	 <attribute name="initParams"/>
 	 </gbean>
 	 
 	 <gbean name="StaticMember2" class="org.apache.geronimo.tomcat.cluster.StaticMemberGBean">
	 <attribute name="className">org.apache.catalina.tribes.membership.StaticMember</attribute>
	 <attribute name="initParams">port=TCP_port2
	  	 securePort=-1
	  	 host=IPAddress2
	  	 domain=test-domain
	  	 UniqueId={2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
	 </attribute>
	 <reference name="NextStaticMember">
	 <name>StaticMember3</name>
	 </reference>
	 </gbean> 
	  	 
	 <gbean name="StaticMember3" class="org.apache.geronimo.tomcat.cluster.StaticMemberGBean">
	 <attribute name="className">org.apache.catalina.tribes.membership.StaticMember</attribute>
	 <attribute name="initParams">port=TCP_port3
	 	  	 securePort=-1
	 	  	 host=IPAddress3
	 	  	 domain=test-domain
	 	  	 UniqueId={2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
	 </attribute>
         </gbean>
...

...