apache mod_jk 负载平衡 glassfish 集群实例问题

发布于 2024-11-16 01:41:07 字数 2236 浏览 6 评论 0原文

我在开源 GlassFish v3.1 服务器上部署了一个 Java EE6 EAR 应用程序,该服务器在 Windows 2003 R2 Server 上运行,位于 2 个集群(每个集群有 2 个实例)上。为了平衡工作负载,我使用带有 mod_jk 的 apache http 服务器。然而,当我查看 jk 状态页面时,我发现工作仅分配给每个集群中的一个实例,即使所有四个实例的 lbfactor 均为 1。有什么想法吗?

JK Status page snapshot

这是我的workers.properties 配置:

worker.list=loadbalancerLocal,status

worker.status.type=status

worker.ViewerLocalInstance1.type=ajp13
worker.ViewerLocalInstance1.host=localhost
worker.ViewerLocalInstance1.port=8109
worker.ViewerLocalInstance1.lbfactor=1
worker.ViewerLocalInstance1.socket_keepalive=1
worker.ViewerLocalInstance1.socket_timeout=1000


worker.ViewerLocalInstance2.type=ajp13
worker.ViewerLocalInstance2.host=localhost
worker.ViewerLocalInstance2.port=8209
worker.ViewerLocalInstance2.lbfactor=1
worker.ViewerLocalInstance2.socket_keepalive=1
worker.ViewerLocalInstance2.socket_timeout=1000

worker.ViewerLocalInstance3.type=ajp13
worker.ViewerLocalInstance3.host=localhost
worker.ViewerLocalInstance3.port=8309
worker.ViewerLocalInstance3.lbfactor=1
worker.ViewerLocalInstance3.socket_keepalive=1
worker.ViewerLocalInstance3.socket_timeout=1000

worker.ViewerLocalInstance4.type=ajp13
worker.ViewerLocalInstance4.host=localhost
worker.ViewerLocalInstance4.port=8409
worker.ViewerLocalInstance4.lbfactor=1
worker.ViewerLocalInstance4.socket_keepalive=1
worker.ViewerLocalInstance4.socket_timeout=1000

worker.loadbalancerLocal.type=lb
worker.loadbalancerLocal.sticky_session=True
worker.loadbalancerLocal.balance_workers=ViewerLocalInstance1,ViewerLocalInstance2,ViewerLocalInstance3,ViewerLocalInstance4

这是我的mod_jk httpd 配置

LoadModule jk_module modules/mod_jk.so
JkWorkersFile conf/workers.properties
# Where to put jk logs
JkLogFile logs/mod_jk.log
# Set the jk log level [debug/error/info]
JkLogLevel info
# Select the log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
# JkOptions indicate to send SSL KEY SIZE,
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
# JkRequestLogFormat set the request format
JkRequestLogFormat "%w %V %T"

JkMount /Viewer/* loadbalancerLocal
JkMount /Viewer loadbalancerLocal
JkMount /jkstatus/* status

I have a Java EE6 EAR application deployed on an Open Source GlassFish v3.1 server running on a Windows 2003 R2 Server on 2 clusters with 2 instances each. To load balance the work load, I am using an apache http server with mod_jk. When I look at the jk status page however I see that the work is being distributed to only one of the instances in each cluster even though all four have the same lbfactor of 1. Any ideas?

JK Status page snapshot

Here is my workers.properties config:

worker.list=loadbalancerLocal,status

worker.status.type=status

worker.ViewerLocalInstance1.type=ajp13
worker.ViewerLocalInstance1.host=localhost
worker.ViewerLocalInstance1.port=8109
worker.ViewerLocalInstance1.lbfactor=1
worker.ViewerLocalInstance1.socket_keepalive=1
worker.ViewerLocalInstance1.socket_timeout=1000


worker.ViewerLocalInstance2.type=ajp13
worker.ViewerLocalInstance2.host=localhost
worker.ViewerLocalInstance2.port=8209
worker.ViewerLocalInstance2.lbfactor=1
worker.ViewerLocalInstance2.socket_keepalive=1
worker.ViewerLocalInstance2.socket_timeout=1000

worker.ViewerLocalInstance3.type=ajp13
worker.ViewerLocalInstance3.host=localhost
worker.ViewerLocalInstance3.port=8309
worker.ViewerLocalInstance3.lbfactor=1
worker.ViewerLocalInstance3.socket_keepalive=1
worker.ViewerLocalInstance3.socket_timeout=1000

worker.ViewerLocalInstance4.type=ajp13
worker.ViewerLocalInstance4.host=localhost
worker.ViewerLocalInstance4.port=8409
worker.ViewerLocalInstance4.lbfactor=1
worker.ViewerLocalInstance4.socket_keepalive=1
worker.ViewerLocalInstance4.socket_timeout=1000

worker.loadbalancerLocal.type=lb
worker.loadbalancerLocal.sticky_session=True
worker.loadbalancerLocal.balance_workers=ViewerLocalInstance1,ViewerLocalInstance2,ViewerLocalInstance3,ViewerLocalInstance4

Here is my httpd config for mod_jk

LoadModule jk_module modules/mod_jk.so
JkWorkersFile conf/workers.properties
# Where to put jk logs
JkLogFile logs/mod_jk.log
# Set the jk log level [debug/error/info]
JkLogLevel info
# Select the log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
# JkOptions indicate to send SSL KEY SIZE,
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
# JkRequestLogFormat set the request format
JkRequestLogFormat "%w %V %T"

JkMount /Viewer/* loadbalancerLocal
JkMount /Viewer loadbalancerLocal
JkMount /jkstatus/* status

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

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

发布评论

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

评论(1

十二 2024-11-23 01:41:07

您已打开粘性会话。尝试将其关闭。如果已设置 jvmRoute,则可能还需要取消设置。

You have the sticky session turned on. Try turning it off. You may need to unset jvmRoute too if you have set it.

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