Spring Session 复制问题

发布于 2024-11-03 12:15:31 字数 1540 浏览 0 评论 0原文

我目前正在研究 Spring 项目的负载平衡。我使用 Apache Web 服务器作为多个 Tomcat 实例的前端。我使用 mod_jk 进行负载平衡。当我运行它时,如果我关闭一台服务器,我必须再次登录系统。之前我也用 Tomcat 的会话示例程序在更简单的示例中尝试过,并且会话复制工作得很好。

这是我对 Apache 的 httpd.conf mod_jk 部分的配置:

LoadModule jk_module modules/mod_jk.so

JkWorkersFile conf/workers.properties
JkLogFile logs/jk.log
JkLogLevel debug
JkLogLevel info
JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
JkRequestLogFormat "%w %V %T"

JkMount /test balancer <-- this is the spring program
JkMount /test/* balancer <-- this is the spring program
JkMount /jk_status status`

这是我的workers.properties 设置:

workers.tomcat_home=/worker1
workers.java_home=$JAVA_HOME
ps=/

worker.list=balancer,status

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

worker.worker2.port=8109
worker.worker2.host=localhost
worker.worker2.type=ajp13
worker.worker2.lbfactor=1

worker.balancer.type=lb
worker.balancer.balance_workers=worker1,worker2
worker.balancer.method=B
worker.balancer.sticky_session=1

worker.status.type=status

我在这里放置了一个 Tomcat 的 server.xml 示例: http://pastebin.com/0j0ta2WA

我还添加了 标签我的应用程序的 web.xml。我在这里错过了什么导致会话复制无法工作吗?

  • Tomcat 5.5
  • Apache 2.2
  • mod_jk
  • Spring 2.5.6
  • JDK 1.6.0_01

I've currently researching in load balancing my Spring project. I've used Apache web server as front-end to multiple Tomcat instances. I've used mod_jk for the load balancing. When I run it, if I shutdown one server, i had to login again to the system. Previously I also tried it in simpler example with the Tomcat's session example program and the session replication worked fine.

This is my configuration for the Apache's httpd.conf mod_jk part:

LoadModule jk_module modules/mod_jk.so

JkWorkersFile conf/workers.properties
JkLogFile logs/jk.log
JkLogLevel debug
JkLogLevel info
JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
JkRequestLogFormat "%w %V %T"

JkMount /test balancer <-- this is the spring program
JkMount /test/* balancer <-- this is the spring program
JkMount /jk_status status`

And this is my workers.properties setting:

workers.tomcat_home=/worker1
workers.java_home=$JAVA_HOME
ps=/

worker.list=balancer,status

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

worker.worker2.port=8109
worker.worker2.host=localhost
worker.worker2.type=ajp13
worker.worker2.lbfactor=1

worker.balancer.type=lb
worker.balancer.balance_workers=worker1,worker2
worker.balancer.method=B
worker.balancer.sticky_session=1

worker.status.type=status

And I've put a sample of one of my tomcat's server.xml here: http://pastebin.com/0j0ta2WA

I've also added <distributable/> tag to my application's web.xml. Is there something I missed here that made the session replication not working?

  • Tomcat 5.5
  • Apache 2.2
  • mod_jk
  • Spring 2.5.6
  • JDK 1.6.0_01

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

走过海棠暮 2024-11-10 12:15:31

您的 server.xml 中是否定义了 jvmRoute?
这是文档:
http://tomcat.apache.org/tomcat-5.5-doc/config /engine.html
我会查看您的 server.xml 但链接错误。

Do you have a jvmRoute defined in your server.xml?
Here are the docs:
http://tomcat.apache.org/tomcat-5.5-doc/config/engine.html
I would have looked at your server.xml but the link is wrong.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文