开发者社区> 问答> 正文

SLB两台tomcat集群session无法复制的问题

SLB+两台tomcat集群以后,A节点项目登录以后,又跳回B节点重复要求登录,应该是session没有复制过去。
tomcat日志里面没看到两台链接的关联输出,好像互相 [font=arial, 宋体, sans-serif, tahoma, 'Microsoft YaHei']监测不到
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配置为


展开
收起
配妞 2016-07-17 15:24:01 14215 0
2 条回答
写回答
取消 提交回答
  • 一个程序员,欢迎骚扰!!!
    SLB没用过 不过楼主可以 提交下工单 咨询下工程师
    2016-07-17 19:12:44
    赞同 展开评论 打赏
  • Re回 楼主配妞的帖子
    前端协议 [端口]:HTTP:80
    后端协议 [端口]:HTTP:8080
    带宽峰值:4M[
    调度算法:
    加权轮询加权最小连接数
    使用虚拟服务器组:a
    会话保持:已开启 HTTP 协议会话保持基于cookie
    Cookie处理方式:
    植入Cookie重写Cookie
    超时时间: *
    输入范围为1-86400秒。
    获取真实IP:

    已开启(默认开启)

    -------------------------

    ReSLB两台tomcat集群session无法复制的问题
    请问各位大侠,为这个是什么问题?
    2016-07-17 15:24:58
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
大规模场景下KubernetesService 负载均衡性能 立即下载
《应用型负载均衡ALB产品解读》 立即下载
阿里云网络-SLB负载均衡产品介绍 立即下载