johnnyKing 2009-06-19 08:26
浏览 229
已采纳

急求 apache2.2 tomcat6 jk_mod session 不能复制

本机 两个tomcat,一个apache,现在已经能够实现负载均衡,但是session一直不能复制。
appache

  1. http.conf:添加 Include conf/mod_jk.conf
  2. mod_jk.conf内容:

    LoadModule jk_module modules/mod_jk.so
    JkWorkersFile conf/workers.properties

    Order allow,deny
    Deny from all


    ServerAdmin localhost
    DocumentRoot E:/wwwroot
    ServerName localhost
    DirectoryIndex index.html index.htm index.jsp

    JkMount /servlet/* controller
    JkMount /*.jsp controller
    JkMount /*.html controller

  3. workers.properties内容:

    worker.list = controller ,tomcat1,tomcat2

#========controller,负载均衡控制器========
worker.controller.type=lb
worker.controller.balanced_workers=tomcat1,tomcat2 #指定分担请求的tomcat
worker.controller.sticky_session=1
#worker.controller.type=status

worker.tomcat1.port=8009
worker.tomcat1.host=localhost
worker.tomcat1.type=ajp13
worker.tomcat1.lbfactor = 1

worker.tomcat2.port=9009
worker.tomcat2.host=localhost
worker.tomcat2.type=ajp13
worker.tomcat2.lbfactor = 1

  1. tomcat1:
    [code="java"]
    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.4"
                    port="45564"
                    frequency="500"
                    dropTime="3000"/>
        <Receiver className="org.apache.catalina.tribes.transport.nio.NioReceiver"
                  address="auto"
                  port="4000"
                  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"
    
                watchEnabled="false"/>
    
      <ClusterListener className="org.apache.catalina.ha.session.JvmRouteSessionIDBinderListener"/>
      <ClusterListener className="org.apache.catalina.ha.session.ClusterSessionListener"/>
    </Cluster>  [/code] 
    

    5 tomcat2:

[code="java"]
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.4"
                    port="45564"
                    frequency="500"
                    dropTime="3000"/>
        <Receiver className="org.apache.catalina.tribes.transport.nio.NioReceiver"
                  address="auto"
                  port="4002"
                  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"

                watchEnabled="false"/>

      <ClusterListener className="org.apache.catalina.ha.session.JvmRouteSessionIDBinderListener"/>
      <ClusterListener className="org.apache.catalina.ha.session.ClusterSessionListener"/>
    </Cluster>   [/code]

6: tomcat1:

[code="java"] unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
[/code]

7:tomcat2:
[code="java"] unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
[/code]

8:应用中web.xml已添加 节点

结果: 能实现负载均衡,但是 session不能复制。
appache:2.2
tomcat:6

展开全部

  • 写回答

3条回答 默认 最新

  • ywbanm 2009-06-19 08:49
    关注

    其实你用jk_mod了
    使用它的stick session就可以了,没必要再要tomcat去复制session了

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)
编辑
预览

报告相同问题?

悬赏问题

  • ¥15 eNSP中防火墙的使用
  • ¥15 不能对数据库增删改但是可以查询
  • ¥15 在触控设备上启动TabTip.exe打不开键盘界面,怎么用代码启动进程打开界面
  • ¥15 lvgl7.11怎么做出文字被选中的效果
  • ¥50 如何快速查看手机目标app的主要服务器ip
  • ¥15 (标签-stm32|关键词-m3)
  • ¥15 matlab中频率调制法代码的解读
  • ¥15 ceph的对象、块、文件相关问题求解答
  • ¥50 如果使用python进行ERA5 10米风场预报检验
  • ¥15 navicat解析mysql密码