mod_proxy:粘性会话不起作用
我有两台 JBoss AS 7 服务器,我正在使用 mod_proxy
进行负载平衡。除了粘性会话之外,几乎一切都工作正常。我的会话 ID 在 cookie 中,而不是在 URL 中,如 JSESSIONID
。
这是我的阿帕奇配置:
NameVirtualHost *:80
<VirtualHost *:80>
ProxyPass / balancer://mycluster/ stickysession=JSESSIONID|jsessionid nofailover=Off
ProxyPassReverse / balancer://tutcluster/
ProxyPassReverse / http://server1:8080/
ProxyPassReverse / http://server2:8080/
ProxyPreserveHost On
ProxyRequests Off
<Location / >
Order deny,allow
Allow from All
</Location>
<Proxy balancer://mycluster/>
BalancerMember http://server1:8080 route=jbossWeb1 retry=60
BalancerMember http://server2:8080 route=jbossWeb2 retry=60
</Proxy>
</VirtualHost>
I have two JBoss AS 7 servers and I'm doing load balancing using mod_proxy
. Almost everything works fine besides sticky sessions. I have session id in a cookie not in the URL as JSESSIONID
.
Here is my apache configuration:
NameVirtualHost *:80
<VirtualHost *:80>
ProxyPass / balancer://mycluster/ stickysession=JSESSIONID|jsessionid nofailover=Off
ProxyPassReverse / balancer://tutcluster/
ProxyPassReverse / http://server1:8080/
ProxyPassReverse / http://server2:8080/
ProxyPreserveHost On
ProxyRequests Off
<Location / >
Order deny,allow
Allow from All
</Location>
<Proxy balancer://mycluster/>
BalancerMember http://server1:8080 route=jbossWeb1 retry=60
BalancerMember http://server2:8080 route=jbossWeb2 retry=60
</Proxy>
</VirtualHost>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好的,我找到了。有两个问题首先我忘记在 JBoss 配置中设置 jvmRoute 属性。所以我设置:
并将工作人员配置更改为:
第二个问题是
nofailover=Off
。这可能导致静态内容的某些部分是从一台服务器加载的,而另一些部分是从另一台服务器加载的。OK, I've found it. There were two problems Firstly I forgot to set
jvmRoute
property in the JBoss configuration. So I set:and changed workers configuration to:
The second problem was
nofailover=Off
. It probably caused that some parts of the static content was loaded from one server and some parts of it -- from another one.