我已经为我的 java 应用程序配置HttpServer2.2了load balancing和。Clustering
但Load Balancing工作正常,Clustering(session replication)不工作。
我worker.properties的HttpServer愿望是,
workers.java_home=C:/Program Files/Java/jdk1.6.0_25
#worker.list=worker1,worker2
worker.list=balancer
worker.worker1.port=8009
worker.worker1.host=localhost
worker.worker1.type=ajp13
worker.worker1.lbfactor=1
worker.worker2.port=8019
worker.worker2.host=192.168.100.84
worker.worker2.type=ajp13
worker.worker2.lbfactor=1
worker.balancer.type=lb
worker.balancer.balance_workers=worker1,worker2
worker.balancer.method=B
# Specifies whether requests with SESSION ID's 
# should be routed back to the same #Tomcat worker.
worker.balancer.sticky_session =True
并且httpd.conf将是,
<IfModule jk_module>
JkWorkersFile conf/workers.properties
JkLogFile logs/mod_jk.log
JkLogLevel info
JkMount /CustomerChat_V1.02.00 balancer
JkMount /CustomerChat_V1.02.00/* balance
</IfModule>
在我server.xml的 for 中Tomcat one,
<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.8"
            port="45564"
            frequency="500"
            dropTime="3000" />
        <Receiver className="org.apache.catalina.tribes.transport.nio.NioReceiver"
              address="auto"
              port="4200"
              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=".*\.gif;.*\.js;.*\.jpg;.*\.htm;.*\.html;.*\.txt;" />
     <Deployer className="org.apache.catalina.ha.deploy.FarmWarDeployer"
           tempDir="D:/cluster/temp/war-temp/"
           deployDir="D:/cluster/temp/war-deploy/"
           watchDir="D:/cluster/temp/war-listen/"
           watchEnabled="false" />
     <ClusterListener className="org.apache.catalina.ha.session.JvmRouteSessionIDBinderListener"/>
     <ClusterListener className="org.apache.catalina.ha.session.ClusterSessionListener"/>
</Cluster>
在我server.xml的 for 中Tomcat two,
       <Receiver className="org.apache.catalina.tribes.transport.nio.NioReceiver"
                  address="192.168.0.1"
                  port="4100"
                  autoBind="100"
                  selectorTimeout="5000"
                  maxThreads="6" />
但仍然有问题。
当我关闭时Tomcat one,新请求将自动转到tomcat two. 但是Tomcat two不知道当前用户状态和他存储的应用程序会话对象。
希望我们的堆栈成员能帮助我。
好的答案绝对值得赞赏。