Sticky Session in apache doesn't work

喜你入骨 提交于 2019-12-21 23:17:57

问题


This is currently my environment setup.

Apache Tomcat: Apache-Tomacat-7.0.21

Apache HTTP Server: c. Apache HTTP Server 2.2.19

Tomcat Connector JK 1.2.32 for Apache HTTP Server 2, mod_jk

I'm trying to implement sticky session but i still can't get it to work. I'm able to load balance between 2 machines in a cluster. Please advise what else i have missed out!

Following is my workers.properties file

# Define 2 real workers using ajp13 & 1 balancer
worker.list=balancer

#
worker.balancer.type=lb
worker.balancer.balance_workers=worker1,worker2
worker.balancer.sticky_session=True

# Set properties for worker1 (ajp13)
worker.worker1.type=ajp13
worker.worker1.host=localhost
worker.worker1.port=8009
worker.worker1.lbfactor=50
worker.worker1.cachesize=10
worker.worker1.cache_timeout=600
worker.worker1.socket_keepalive=1
worker.worker1.recycle_timeout=300

# Set properties for worker2 (ajp13)
worker.worker2.type=ajp13
worker.worker2.host=X.X.X.X
worker.worker2.port=8009
worker.worker2.lbfactor=50
worker.worker2.cachesize=10
worker.worker2.cache_timeout=600
worker.worker2.socket_keepalive=1
worker.worker2.recycle_timeout=300

I've also set the jvmRoute in server.xml to:

<Engine name="Catalina" defaultHost="localhost" jvmRoute="worker1">

来源:https://stackoverflow.com/questions/7430570/sticky-session-in-apache-doesnt-work

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!