有人知道为什么会话复制对我不起作用吗?带有会话的负载均衡器 亲和力很好用,但是在重新配置设置以进行会话复制后, 不持久。
我在日志中有信息
org.apache.catalina.ha.session.DeltaManager.getAllClusterSessions Manager [localhost#/ sessionlogin]:跳过状态转移。群集组中没有活动的成员。
我在下面的worker.properties的配置
worker.list=loadbalancer,status
worker.jvm1.type=ajp13
worker.jvm1.port=8109
worker.jvm1.host=localhost
worker.jvm1.lbfactor=10
worker.jvm2.type=ajp13
worker.jvm2.port=8209
worker.jvm2.host=localhost
worker.jvm2.lbfactor=10
worker.jvm3.type=ajp13
worker.jvm3.port=8309
worker.jvm3.host=localhost
worker.jvm3.lbfactor=10
worker.loadbalancer.type=lb
worker.loadbalancer.balance_workers=jvm1,jvm2,jvm3
worker.loadbalancer.sticky_session=1
worker.status.type=status
---- workers.properties -------这里
我的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 /* loadbalancer
JkMount /status status
server.xml文件具有以下配置
<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"
channelSendOptions="6"/>
<!-- Add by dinesh for Session Replication in Tomcat Clustering ****Start**** -->
<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"
channelSendOptions="8">
<!-- <Manager className="org.apache.catalina.ha.session.BackupManager"
expireSessionsOnShutdown="false"
notifyListenersOnReplication="true"
mapSendOptions="6"/>
<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="228.0.0.4"
port="45564"
frequency="500"
dropTime="3000"/>
<Receiver className="org.apache.catalina.tribes.transport.nio.NioReceiver"
address="auto"
port="4001"
selectorTimeout="100"
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>
<!-- Add by dinesh for Session Replication in Tomcat Clustering ****End****
As referred some document i have add the manager tag in context.xml file
<Context>
<Manager className="org.apache.catalina.ha.session.DeltaManager"
expireSessionsOnShutdown="false"
notifyListenersOnReplication="true" />
</Context>
我在其他实例上更改了接收器端口,并更改了名称。
,然后我将可分发标记添加到web.xml的开头:
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
<distributable />
(lots more...)
</web-app>
我的实例1日志
02-Jul-2018 19:26:39.588 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version: Apache Tomcat/8.0.52
02-Jul-2018 19:26:39.591 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built: Apr 28 2018 16:24:29 UTC
02-Jul-2018 19:26:39.591 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server number: 8.0.52.0
02-Jul-2018 19:26:39.592 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name: Linux
02-Jul-2018 19:26:39.592 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version: 2.6.32-696.30.1.el6.x86_64
02-Jul-2018 19:26:39.592 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture: amd64
02-Jul-2018 19:26:39.592 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home: /usr/java/jdk1.8.0_51/jre
02-Jul-2018 19:26:39.592 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version: 1.8.0_51-b16
02-Jul-2018 19:26:39.592 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor: Oracle Corporation
02-Jul-2018 19:26:39.592 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE: /home/bdineshkumar/projects/Clients/VMServer/Sever_Tomcat8.0.52/Instance1
02-Jul-2018 19:26:39.593 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME: /home/bdineshkumar/projects/Clients/VMServer/Sever_Tomcat8.0.52/Instance1
02-Jul-2018 19:26:39.593 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=/home/bdineshkumar/projects/Clients/VMServer/Sever_Tomcat8.0.52/Instance1/conf/logging.properties
02-Jul-2018 19:26:39.593 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
02-Jul-2018 19:26:39.593 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
02-Jul-2018 19:26:39.594 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources
02-Jul-2018 19:26:39.594 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dignore.endorsed.dirs=
02-Jul-2018 19:26:39.594 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=/home/bdineshkumar/projects/Clients/VMServer/Sever_Tomcat8.0.52/Instance1
02-Jul-2018 19:26:39.594 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=/home/bdineshkumar/projects/Clients/VMServer/Sever_Tomcat8.0.52/Instance1
02-Jul-2018 19:26:39.594 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=/home/bdineshkumar/projects/Clients/VMServer/Sever_Tomcat8.0.52/Instance1/temp
02-Jul-2018 19:26:39.594 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
02-Jul-2018 19:26:39.798 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8181"]
02-Jul-2018 19:26:39.823 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
02-Jul-2018 19:26:39.826 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8109"]
02-Jul-2018 19:26:39.828 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
02-Jul-2018 19:26:39.829 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 798 ms
02-Jul-2018 19:26:39.862 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service Catalina
02-Jul-2018 19:26:39.863 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.0.52
02-Jul-2018 19:26:39.875 INFO [main] org.apache.catalina.ha.tcp.SimpleTcpCluster.startInternal Cluster is about to start
02-Jul-2018 19:26:39.882 INFO [main] org.apache.catalina.tribes.transport.ReceiverBase.bind Receiver Server Socket bound to:/192.168.192.131:4002
02-Jul-2018 19:26:39.895 INFO [main] org.apache.catalina.tribes.membership.McastServiceImpl.setupSocket Setting cluster mcast soTimeout to 500
02-Jul-2018 19:26:39.900 INFO [main] org.apache.catalina.tribes.membership.McastServiceImpl.waitForMembers Sleeping for 1000 milliseconds to establish cluster membership, start level:4
02-Jul-2018 19:26:40.900 INFO [main] org.apache.catalina.tribes.membership.McastServiceImpl.waitForMembers Done sleeping, membership established, start level:4
02-Jul-2018 19:26:40.903 INFO [main] org.apache.catalina.tribes.membership.McastServiceImpl.waitForMembers Sleeping for 1000 milliseconds to establish cluster membership, start level:8
02-Jul-2018 19:26:41.903 INFO [main] org.apache.catalina.tribes.membership.McastServiceImpl.waitForMembers Done sleeping, membership established, start level:8
02-Jul-2018 19:26:41.928 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /home/bdineshkumar/projects/Clients/VMServer/Sever_Tomcat8.0.52/Instance1/webapps/manager
02-Jul-2018 19:26:42.356 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /home/bdineshkumar/projects/Clients/VMServer/Sever_Tomcat8.0.52/Instance1/webapps/manager has finished in 427 ms
02-Jul-2018 19:26:42.356 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /home/bdineshkumar/projects/Clients/VMServer/Sever_Tomcat8.0.52/Instance1/webapps/host-manager
02-Jul-2018 19:26:42.409 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /home/bdineshkumar/projects/Clients/VMServer/Sever_Tomcat8.0.52/Instance1/webapps/host-manager has finished in 53 ms
02-Jul-2018 19:26:42.410 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /home/bdineshkumar/projects/Clients/VMServer/Sever_Tomcat8.0.52/Instance1/webapps/sessionlogin
02-Jul-2018 19:26:42.467 INFO [localhost-startStop-1] org.apache.catalina.ha.session.DeltaManager.startInternal Register manager localhost#/sessionlogin to cluster element Engine with name Catalina
02-Jul-2018 19:26:42.468 INFO [localhost-startStop-1] org.apache.catalina.ha.session.DeltaManager.startInternal Starting clustering manager at localhost#/sessionlogin
02-Jul-2018 19:26:42.468 INFO [localhost-startStop-1] org.apache.catalina.ha.session.DeltaManager.getAllClusterSessions Manager [localhost#/sessionlogin]: skipping state transfer. No members active in cluster group.
02-Jul-2018 19:26:42.474 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /home/bdineshkumar/projects/Clients/VMServer/Sever_Tomcat8.0.52/Instance1/webapps/sessionlogin has finished in 63 ms
02-Jul-2018 19:26:42.474 INFO [main] org.apache.catalina.ha.session.JvmRouteBinderValve.startInternal JvmRouteBinderValve started
02-Jul-2018 19:26:42.478 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8181"]
02-Jul-2018 19:26:42.489 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8109"]
02-Jul-2018 19:26:42.497 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 2668 ms
和我的服务器2日志是
02-Jul-2018 19:26:45.712 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version: Apache Tomcat/8.0.52
02-Jul-2018 19:26:45.715 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built: Apr 28 2018 16:24:29 UTC
02-Jul-2018 19:26:45.715 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server number: 8.0.52.0
02-Jul-2018 19:26:45.715 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name: Linux
02-Jul-2018 19:26:45.716 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version: 2.6.32-696.30.1.el6.x86_64
02-Jul-2018 19:26:45.716 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture: amd64
02-Jul-2018 19:26:45.716 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home: /usr/java/jdk1.8.0_51/jre
02-Jul-2018 19:26:45.716 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version: 1.8.0_51-b16
02-Jul-2018 19:26:45.717 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor: Oracle Corporation
02-Jul-2018 19:26:45.717 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE: /home/bdineshkumar/projects/Clients/VMServer/Sever_Tomcat8.0.52/Instance2
02-Jul-2018 19:26:45.717 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME: /home/bdineshkumar/projects/Clients/VMServer/Sever_Tomcat8.0.52/Instance2
02-Jul-2018 19:26:45.717 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=/home/bdineshkumar/projects/Clients/VMServer/Sever_Tomcat8.0.52/Instance2/conf/logging.properties
02-Jul-2018 19:26:45.718 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
02-Jul-2018 19:26:45.718 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
02-Jul-2018 19:26:45.718 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources
02-Jul-2018 19:26:45.718 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dignore.endorsed.dirs=
02-Jul-2018 19:26:45.718 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=/home/bdineshkumar/projects/Clients/VMServer/Sever_Tomcat8.0.52/Instance2
02-Jul-2018 19:26:45.718 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=/home/bdineshkumar/projects/Clients/VMServer/Sever_Tomcat8.0.52/Instance2
02-Jul-2018 19:26:45.719 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=/home/bdineshkumar/projects/Clients/VMServer/Sever_Tomcat8.0.52/Instance2/temp
02-Jul-2018 19:26:45.719 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
02-Jul-2018 19:26:45.935 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8282"]
02-Jul-2018 19:26:45.966 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
02-Jul-2018 19:26:46.033 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8209"]
02-Jul-2018 19:26:46.035 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
02-Jul-2018 19:26:46.036 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 1790 ms
02-Jul-2018 19:26:46.063 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service Catalina
02-Jul-2018 19:26:46.063 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.0.52
02-Jul-2018 19:26:46.075 INFO [main] org.apache.catalina.ha.tcp.SimpleTcpCluster.startInternal Cluster is about to start
02-Jul-2018 19:26:46.081 INFO [main] org.apache.catalina.tribes.transport.ReceiverBase.bind Receiver Server Socket bound to:/192.168.192.131:4001
02-Jul-2018 19:26:46.093 INFO [main] org.apache.catalina.tribes.membership.McastServiceImpl.setupSocket Setting cluster mcast soTimeout to 500
02-Jul-2018 19:26:46.096 INFO [main] org.apache.catalina.tribes.membership.McastServiceImpl.waitForMembers Sleeping for 1000 milliseconds to establish cluster membership, start level:4
02-Jul-2018 19:26:47.096 INFO [main] org.apache.catalina.tribes.membership.McastServiceImpl.waitForMembers Done sleeping, membership established, start level:4
02-Jul-2018 19:26:47.099 INFO [main] org.apache.catalina.tribes.membership.McastServiceImpl.waitForMembers Sleeping for 1000 milliseconds to establish cluster membership, start level:8
02-Jul-2018 19:26:48.099 INFO [main] org.apache.catalina.tribes.membership.McastServiceImpl.waitForMembers Done sleeping, membership established, start level:8
02-Jul-2018 19:26:48.129 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /home/bdineshkumar/projects/Clients/VMServer/Sever_Tomcat8.0.52/Instance2/webapps/manager
02-Jul-2018 19:26:53.191 WARNING [localhost-startStop-1] org.apache.catalina.util.SessionIdGeneratorBase.createSecureRandom Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [4,718] milliseconds.
02-Jul-2018 19:26:53.221 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /home/bdineshkumar/projects/Clients/VMServer/Sever_Tomcat8.0.52/Instance2/webapps/manager has finished in 5,093 ms
02-Jul-2018 19:26:53.222 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /home/bdineshkumar/projects/Clients/VMServer/Sever_Tomcat8.0.52/Instance2/webapps/host-manager
02-Jul-2018 19:26:53.283 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /home/bdineshkumar/projects/Clients/VMServer/Sever_Tomcat8.0.52/Instance2/webapps/host-manager has finished in 60 ms
02-Jul-2018 19:26:53.283 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /home/bdineshkumar/projects/Clients/VMServer/Sever_Tomcat8.0.52/Instance2/webapps/sessionlogin
02-Jul-2018 19:26:53.350 INFO [localhost-startStop-1] org.apache.catalina.ha.session.DeltaManager.startInternal Register manager localhost#/sessionlogin to cluster element Engine with name Catalina
02-Jul-2018 19:26:53.350 INFO [localhost-startStop-1] org.apache.catalina.ha.session.DeltaManager.startInternal Starting clustering manager at localhost#/sessionlogin
02-Jul-2018 19:26:53.350 INFO [localhost-startStop-1] org.apache.catalina.ha.session.DeltaManager.getAllClusterSessions Manager [localhost#/sessionlogin]: skipping state transfer. No members active in cluster group.
02-Jul-2018 19:26:53.356 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /home/bdineshkumar/projects/Clients/VMServer/Sever_Tomcat8.0.52/Instance2/webapps/sessionlogin has finished in 73 ms
02-Jul-2018 19:26:53.357 INFO [main] org.apache.catalina.ha.session.JvmRouteBinderValve.startInternal JvmRouteBinderValve started
02-Jul-2018 19:26:53.362 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8282"]
02-Jul-2018 19:26:53.373 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8209"]
02-Jul-2018 19:26:53.377 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 7341 ms
请注意此错误
02-Jul-2018 19:26:53.350 INFO [localhost-startStop-1] org.apache.catalina.ha.session.DeltaManager.getAllClusterSessions Manager [localhost#/sessionlogin]: skipping state transfer. No members active in cluster group.
02-Jul-2018 19:26:53.191 WARNING [localhost-startStop-1] org.apache.catalina.util.SessionIdGeneratorBase.createSecureRandom Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [4,718] milliseconds.
预先感谢