0

I'm trying to configure Session Replication on two tomcats on separate EC2 (AWS) instances. I can't find any example on internet of such configuration. I've prepared configuration in accordance with this documentation: cluster-howto

tomcat 1:

<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster" 
           channelSendOptions="8" channelStartOptions = "3">
      <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.StaticMembershipService">
                <LocalMember className="org.apache.catalina.tribes.membership.StaticMember"
                          uniqueId="{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,0}"/>
                <Member className="org.apache.catalina.tribes.membership.StaticMember"
                          port="4110"
                          host="10.0.200.221"
                          domain="tomcat-sys-ws"
                          uniqueId="{0,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1}" />
            </Membership>

           <Receiver className="org.apache.catalina.tribes.transport.nio.NioReceiver"
                     address="10.0.200.82"
                     port="4110"
                     autoBind="9"
                     selectorTimeout="2000"
                     maxThreads="6"/>

           <Sender className="org.apache.catalina.tribes.transport.ReplicationTransmitter">
                <Transport className="org.apache.catalina.tribes.transport.nio.PooledParallelSender"/>
           </Sender>

           <Interceptor className="org.apache.catalina.tribes.group.interceptors.TcpPingInterceptor"/>
           <Interceptor className="org.apache.catalina.tribes.group.interceptors.TcpFailureDetector"/>
           <Interceptor className="org.apache.catalina.tribes.group.interceptors.MessageDispatchInterceptor"/>
           <Interceptor className="org.apache.catalina.tribes.group.interceptors.ThroughputInterceptor"/>

           <Interceptor className="org.apache.catalina.tribes.group.interceptors.StaticMembershipInterceptor">
                <Member className="org.apache.catalina.tribes.membership.StaticMember"
                          port="4110"
                          host="10.0.200.221"
                          domain="tomcat-sys-ws"
                          uniqueId="{0,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1}" />
           </Interceptor>

      </Channel>

      <Valve className="org.apache.catalina.ha.tcp.ReplicationValve" filter=""/>
      <Valve className="org.apache.catalina.ha.session.JvmRouteBinderValve"/>

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

tomcat 2

 <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster" 
           channelSendOptions="8" channelStartOptions = "3">
      <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.StaticMembershipService">
                <LocalMember className="org.apache.catalina.tribes.membership.StaticMember"
                             uniqueId="{0,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1}"/>
                <Member className="org.apache.catalina.tribes.membership.StaticMember"
                          port="4110"
                          host="10.0.200.82"
                          domain="tomcat-sys"
                          uniqueId="{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,0}" />
            </Membership>

           <Receiver className="org.apache.catalina.tribes.transport.nio.NioReceiver"
                     address="10.0.200.221"
                     port="4110"
                     autoBind="9"
                     selectorTimeout="2000"
                     maxThreads="6"/>

           <Sender className="org.apache.catalina.tribes.transport.ReplicationTransmitter">
                <Transport className="org.apache.catalina.tribes.transport.nio.PooledParallelSender"/>
           </Sender>

           <Interceptor className="org.apache.catalina.tribes.group.interceptors.TcpPingInterceptor"/>
           <Interceptor className="org.apache.catalina.tribes.group.interceptors.TcpFailureDetector"/>
           <Interceptor className="org.apache.catalina.tribes.group.interceptors.MessageDispatchInterceptor"/>
           <Interceptor className="org.apache.catalina.tribes.group.interceptors.ThroughputInterceptor"/>

           <Interceptor className="org.apache.catalina.tribes.group.interceptors.StaticMembershipInterceptor">
                <Member className="org.apache.catalina.tribes.membership.StaticMember"
                          port="4110"
                          host="10.0.200.82"
                          domain="tomcat-sys"
                          uniqueId="{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,0}" />
           </Interceptor>

      </Channel>

      <Valve className="org.apache.catalina.ha.tcp.ReplicationValve" filter=""/>
      <Valve className="org.apache.catalina.ha.session.JvmRouteBinderValve"/>

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

output of lsof -i -P -n | grep 4110 command:

tomcat 1:

java    3872   ws   61u  IPv6  28517      0t0  TCP 10.0.200.82:4110 (LISTEN)
java    3872   ws   69u  IPv6  30873      0t0  TCP 10.0.200.82:4110->10.0.200.221:47020 (ESTABLISHED)
java    3872   ws   77u  IPv6  30882      0t0  TCP 10.0.200.82:58452->10.0.200.221:4110 (ESTABLISHED)

tomcat 2:

java      6888 mibbot   62u  IPv6  28987      0t0  TCP 10.0.200.221:4110 (LISTEN)
java      6888 mibbot   71u  IPv6  28590      0t0  TCP 10.0.200.221:47020->10.0.200.82:4110 (ESTABLISHED)
java      6888 mibbot  281u  IPv6  29035      0t0  TCP 10.0.200.221:4110->10.0.200.82:58452 (ESTABLISHED)

errors in file with cluster logs:

23-Apr-2020 11:28:18.498 FINE [Tribes-Task-Receiver[Catalina-Channel]-1] org.apache.catalina.tribes.transport.nio.NioReplicationTask.remoteEof Channel closed on the remote end, disconnecting
23-Apr-2020 11:28:20.643 INFO [MessageDispatchInterceptor.MessageDispatchThread[Catalina-Channel]1] org.apache.catalina.tribes.group.interceptors.ThroughputInterceptor.report ThroughputInterceptor Report[
        Tx Msg:1 messages
        Sent:0.00 MB (total)
        Sent:0.00 MB (application)
        Time:0.00 seconds
        Tx Speed:∞ MB/sec (total)
        Tx Speed:∞ MB/sec (application)
        Error Msg:0
        Rx Msg:4 messages
        Rx Speed:0.00 MB/sec (since 1st msg)
        Received:0.00 MB]

23-Apr-2020 11:28:23.498 FINE [Tribes-Task-Receiver[Catalina-Channel]-5] org.apache.catalina.tribes.group.interceptors.TcpFailureDetector.messageReceived Received a failure detector packet:ClusterData[src=org.ap
ache.catalina.tribes.membership.MemberImpl[tcp://{10, 0, 200, 221}:4110,{10, 0, 200, 221},4110, alive=1587638117809, securePort=-1, UDP Port=-1, id={0 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 }, payload={}, command={
}, domain={}]; id={-110 -41 53 -5 37 -7 72 -84 -101 52 55 37 -46 3 83 41 }; sent=2020-04-23 11:28:23.497]

Any idea what should I change in my configuration?

0

move

      <Manager className="org.apache.catalina.ha.session.DeltaManager"
               expireSessionsOnShutdown="false"
               notifyListenersOnReplication="true"/>

to context.xml

1
  • and <cluster> must be inside <host> – zoltek Jan 10 at 0:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.