SLB+两台
tomcat
集群以后,A节点项目登录以后,又跳回B节点重复要求登录,应该是session没有复制过去。
tomcat日志里面没看到两台链接的关联输出,好像互相
监测不到
。
INFO: Initialization processed in 830 ms
Jul 17, 2016 1:14:52 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Jul 17, 2016 1:14:52 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.69
Jul 17, 2016 1:14:52 PM org.apache.catalina.ha.tcp.SimpleTcpCluster startInternal
INFO: Cluster is about to start
Jul 17, 2016 1:14:52 PM org.apache.catalina.tribes.transport.ReceiverBase bind
INFO: Receiver Server Socket bound to:/10.25.171.145:4001
Jul 17, 2016 1:14:52 PM org.apache.catalina.tribes.membership.McastServiceImpl setupSocket
INFO: Setting cluster mcast soTimeout to 500
Jul 17, 2016 1:14:52 PM org.apache.catalina.tribes.membership.McastServiceImpl waitForMembers
INFO: Sleeping for 1000 milliseconds to establish cluster membership, start level:4
Jul 17, 2016 1:14:53 PM org.apache.catalina.tribes.membership.McastServiceImpl waitForMembers
INFO: Done sleeping, membership established, start level:4
Jul 17, 2016 1:14:53 PM org.apache.catalina.tribes.membership.McastServiceImpl waitForMembers
INFO: Sleeping for 1000 milliseconds to establish cluster membership, start level:8
Jul 17, 2016 1:14:54 PM org.apache.catalina.tribes.membership.McastServiceImpl waitForMembers
INFO: Done sleeping, membership established, start level:8
Jul 17, 2016 1:14:54 PM org.apache.catalina.ha.deploy.FarmWarDeployer start
SEVERE: FarmWarDeployer can only work as host cluster subelement!
Jul 17, 2016 1:14:54 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive /mnt/dev1/tomcat/webapps/ROOT.war
Jul 17, 2016 1:15:00 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://shiro.apache.org/tags is already defined
Jul 17, 2016 1:15:00 PM org.apache.catalina.startup.TldConfig execute
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
Jul 17, 2016 1:15:11 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deployment of web application archive /mnt/dev1/tomcat/webapps/ROOT.war has finished in 17,058 ms
Jul 17, 2016 1:15:11 PM org.apache.catalina.ha.session.JvmRouteBinderValve startInternal
INFO: JvmRouteBinderValve started
Jul 17, 2016 1:15:11 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Jul 17, 2016 1:15:11 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Jul 17, 2016 1:15:11 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 19295 ms
执行了
# /sbin/iptables -I INPUT -p udp --dport 45564 -j ACCEPT
# /etc/rc.d/init.d/iptables save
route add -net 224.0.0.0 netmask 240.0.0.0 dev eth0之后也仍然没有效果
我两台tomcat是同一区的。tomcat配置为
两个tomcat pzstomcat1, pzstomcat2其它都一样
server
.xml
<Engine name="Catalina" defaultHost="localhost" jvmRoute="pzstomcat2">
<!--For clustering, please take a look at documentation at:
/docs/cluster-howto.html (simple how to)
/docs/config/cluster.html (reference documentation) -->
<!--
<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
-->
<!-- Note: 负载均衡配置
-->
<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="228.0.0.5"
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"/>
<Deployer className="org.apache.catalina.ha.deploy.FarmWarDeployer"
tempDir="/tmp/war-temp/"
deployDir="/tmp/war-deploy/"
watchDir="/tmp/war-listen/"
watchEnabled="false"/>
<ClusterListener className="org.apache.catalina.ha.session.JvmRouteSessionIDBinderListener"/>
<ClusterListener className="org.apache.catalina.ha.session.ClusterSessionListener"/>
</Cluster>
web.xml
</welcome-file-list>
SLB
配置为
<display-name>session</display-name>
<distributable/>
前端协议 [端口]:HTTP:80
后端协议 [端口]:HTTP:8080
带宽峰值:4M
调度算法:
加权轮询加权最小连接数
使用虚拟服务器组:a
会话保持:已开启
HTTP 协议会话保持基于cookie
Cookie
处理方式:
植入Cookie重写Cookie
超时时间:
*
输入范围为1-86400秒。
获取真实IP:
已开启(默认开启)
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。