apache mod_jk 负载平衡 glassfish 集群实例问题
我在开源 GlassFish v3.1 服务器上部署了一个 Java EE6 EAR 应用程序,该服务器在 Windows 2003 R2 Server 上运行,位于 2 个集群(每个集群有 2 个实例)上。为了平衡工作负载,我使用带有 mod_jk 的 apache http 服务器。然而,当我查看 jk 状态页面时,我发现工作仅分配给每个集群中的一个实例,即使所有四个实例的 lbfactor 均为 1。有什么想法吗?
这是我的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?
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您已打开粘性会话。尝试将其关闭。如果已设置 jvmRoute,则可能还需要取消设置。
You have the sticky session turned on. Try turning it off. You may need to unset jvmRoute too if you have set it.