apache 中的粘性会话不起作用

发布于 2024-12-04 14:43:56 字数 1184 浏览 1 评论 0原文

这是我目前的环境设置。

Apache Tomcat:Apache-Tomacat-7.0.21

Apache HTTP 服务器:c。 Apache HTTP Server 2.2.19

Tomcat Connector JK 1.2.32 for Apache HTTP Server 2, mod_jk

我正在尝试实现粘性会话,但仍然无法让它工作。我能够在集群中的两台机器之间进行负载平衡。请告知我还错过了什么!

以下是我的workers.properties 文件,

# 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

我还将server.xml 中的jvmRoute 设置为:

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

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">

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文