2
我已配置HttpServer2.2
以實現load balancing
和我的java應用程序的Clustering
。會話複製和集羣在tomcat中?
但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
爲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
爲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
不知道應用程序的當前用戶狀態和他存儲的會話對象。
希望我們的堆棧成員能幫助我解決這個問題。
好的答案是肯定讚賞的。
感謝您的回覆......我嘗試了您的答案並更新了我的問題。請檢查它並讓我知道修改。 – 2013-05-09 13:27:30
請檢查兩臺服務器的啓動日誌,看看是否有任何集羣設置相關日誌。無論你所配置的配置對我來說都是正確的。 – Santosh 2013-05-09 15:22:47
所有其他資源告訴我保持'worker.balancer.sticky_session = True'和更多建議? – 2013-05-10 10:24:07