Spring Session 复制问题
我目前正在研究 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的 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.