Estou lutando com a configuração da replicação de sessão no cluster do Tomcat. Os artigos de Ramki sobre o Tomcat Clustering me ajudaram muito. Balanceamento de carga e sessão pegajosa funciona bem.
SessionIDs são replicados, mas apenas IDs. Atributos da sessão não são, eles mudaram apenas no nó primário. A replicação do Apache Tribes da sessão completa está faltando.
Meu ambiente: Oracle Linux 6.6, Tomcat 8.0.20, JRE 7u55-b13
Apache httpd.conf
LoadModule jk_module modules/mod_jk.so
JkWorkersFile conf/workers.properties
JkLogFile logs/mod_jk.log
JkLogLevel emerg
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
JkRequestLogFormat "%w %V %T"
JkMount /status stat
JkMount /* balancer
JkMount /uzel1* uzel1
JkMount /uzel2* uzel2
JkMount /uzel3* uzel3
workers.properties
worker.list=balancer,stat
worker.uzel1.type=ajp13
worker.uzel1.port=8021
worker.uzel1.host=localhost
worker.uzel1.lbfactor=10
worker.uzel2.type=ajp13
worker.uzel2.port=8022
worker.uzel2.host=localhost
worker.uzel2.lbfactor=10
worker.uzel3.type=ajp13
worker.uzel3.port=8023
worker.uzel3.host=localhost
worker.uzel3.lbfactor=10
worker.balancer.type=lb
worker.balancer.balance_workers=uzel1,uzel2,uzel3
worker.stat.type=status
Tomcat1 (uzel1) server.xml (outros nós usam números de porta maiores, por exemplo, 8022, 4001 etc.)
<Connector port="8021" protocol="AJP/1.3" redirectPort="8441" />
<Engine name="Catalina" defaultHost="localhost" jvmRoute="uzel1">
<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster" channelSendOptions="8">
<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="224.0.0.4"
port="45564"
frequency="500"
dropTime="3000"/>
<Receiver className="org.apache.catalina.tribes.transport.nio.NioReceiver"
address="auto"
port="4001"
autoBind="100"
selectorTimeout="5000"
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.TcpFailureDetector"/>
<Interceptor className="org.apache.catalina.tribes.group.interceptors.MessageDispatch15Interceptor"/>
</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>
Quando uma nova sessão é criada, isso é registrado em uzel1 / catalina.out
12-Mar-2015 15:56:53.540 FINE [ajp-nio-8021-exec-1] org.apache.catalina.ha.session.DeltaManager.sendCreateSession Manager [localhost#] send new session (6BB91945986B0B389849887109F97864.uzel1)
12-Mar-2015 15:56:53.542 FINE [ajp-nio-8021-exec-1] org.apache.catalina.ha.session.DeltaManager.createSession Created a DeltaSession with Id [6BB91945986B0B389849887109F97864.uzel1] Total count=1
12-Mar-2015 15:56:53.547 FINE [ajp-nio-8021-exec-1] org.apache.catalina.ha.session.DeltaManager.requestCompleted Manager [localhost#]: create session message [6BB91945986B0B389849887109F97864.uzel1] delta request.
Tomcat2 escreve isso para uzel2 / catalina.out
12-Mar-2015 15:56:53.545 FINE [Tribes-Task-Receiver-5] org.apache.catalina.ha.session.DeltaManager.messageReceived Manager [localhost#]: Received SessionMessage of type=(SESSION-MODIFIED) from [org.apache.catalina.tribes.membership.MemberImpl[tcp://{10, 0, 1, 61}:4001,{10, 0, 1, 61},4001, alive=193202, securePort=-1, UDP Port=-1, id={67 84 5 -55 -55 -93 72 -27 -88 19 109 68 117 4 -82 56 }, payload={}, command={}, domain={}, ]]
12-Mar-2015 15:56:53.546 FINE [Tribes-Task-Receiver-5] org.apache.catalina.ha.session.DeltaManager.handleSESSION_CREATED Manager [localhost#]: received session [6BB91945986B0B389849887109F97864.uzel1] created.
12-Mar-2015 15:56:53.554 FINE [Tribes-Task-Receiver-6] org.apache.catalina.ha.session.DeltaManager.messageReceived Manager [localhost#]: Received SessionMessage of type=(SESSION-DELTA) from [org.apache.catalina.tribes.membership.MemberImpl[tcp://{10, 0, 1, 61}:4001,{10, 0, 1, 61},4001, alive=193202, securePort=-1, UDP Port=-1, id={67 84 5 -55 -55 -93 72 -27 -88 19 109 68 117 4 -82 56 }, payload={}, command={}, domain={}, ]]
12-Mar-2015 15:56:53.555 FINE [Tribes-Task-Receiver-6] org.apache.catalina.ha.session.DeltaManager.handleSESSION_DELTA Manager [localhost#]: received session [6BB91945986B0B389849887109F97864.uzel1] delta.
O segundo nó sabe sobre a nova sessão. No entanto, isso não é replicado.
Nenhum pacote TCP foi acessado nas portas 4001-4003 com
#tcpdump -nnq dst port 4001 or dst port 4002 or dst port 4003
Você tem alguma idéia do que deve ser verificado, descartado, examinado?
Qualquer ajuda é apreciada!
Leos