开发者社区> 问答> 正文

两台同一区ECS服务器tomcat无法复制session怎么解决?

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>
    <display-name>session</display-name>
    <distributable/>
SLB 配置为

前端协议 [端口]:HTTP:80
后端协议 [端口]:HTTP:8080
带宽峰值:4M
调度算法: 加权轮询加权最小连接数
使用虚拟服务器组:a
会话保持:已开启 HTTP 协议会话保持基于cookie
Cookie 处理方式: 植入Cookie重写Cookie
超时时间: * 输入范围为1-86400秒。
获取真实IP: 已开启(默认开启)

展开
收起
配妞 2016-07-17 15:37:04 4730 0
2 条回答
写回答
取消 提交回答
  • Re两台同一区ECS服务器tomcat无法复制session怎么解决?
    我也遇到了这样的问题,刚看了下文档,阿里云的ECS服务器是禁止组播的……
    2016-09-10 15:45:59
    赞同 展开评论 打赏
  • Re两台同一区ECS服务器tomcat无法复制session怎么解决?
    请问楼主问题解决了吗
    2016-08-31 21:13:11
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
如何运维千台以上游戏云服务器 立即下载
网站/服务器取证 实践与挑战 立即下载
ECS块储存产品全面解析 立即下载