Apache 负载平衡无法正常工作 |模组_jk
我有两个 jboss 应用程序服务器(在不同的机器和 IP 地址上),并且我使用 mod_jk 配置将 apache 设置为该应用程序服务器的 Web 服务器。 Apache Web 服务器还设置为在这两个应用程序服务器之间进行负载平衡。
以下是我的workers.properties 文件的内容:
worker.list=portalworker1,portalworker2,portalbalancer
worker.portalbalancer.type=lb
worker.portalbalancer.balance_workers=portalworker1,portalworker2
worker.portalbalancer.sticky_session=True
# Application server 1 Portal application
worker.portalworker1.type=ajp13
worker.portalworker1.host=10.178.197.91
worker.portalworker1.port=8009
worker.portalworker1.lbfactor=1
# Application server 2 Portal application
worker.portalworker2.type=ajp13
worker.portalworker2.host=10.178.197.90
worker.portalworker2.port=8009
worker.portalworker2.lbfactor=1
问题是当前请求正在发送到任何应用程序服务器(例如,应用程序服务器1 上的一个请求和应用程序服务器2 上的第二个请求),这将是明显的。行不通的。
我还在调试模式下检查了 mod_jk 日志:
对于第一个请求
[Tue Dec 13 16:46:12.222 2011] [16097:47166030803776] [debug] get_most_suitable_worker::jk_lb_worker.c (946): searching worker for partial sessionid UH76jWj-q2yX39prlS-nBA**
[Tue Dec 13 16:46:12.222 2011] [16097:47166030803776] [debug] get_most_suitable_worker::jk_lb_worker.c (1001): found best worker portalworker2 (portalworker2) using method 'Request'
对于第二个请求:
[Tue Dec 13 16:46:12.434 2011] [16100:47166030803776] [debug] get_most_suitable_worker::jk_lb_worker.c (946): searching worker for partial sessionid UH76jWj-q2yX39prlS-nBA**
[Tue Dec 13 16:46:12.434 2011] [16100:47166030803776] [debug] get_most_suitable_worker::jk_lb_worker.c (1001): found best worker portalworker1 (portalworker1) using method 'Request'
这也确保了 2 个请求集的 sessionid 相同,但仍找到不同的工作人员。
知道我做错了什么吗?
I have two jboss application server (on different machines and ip address) and I have setup apache as web server for this application server using mod_jk configuration. Apache web server is also setup to load balance between these two application servers.
Following is the content of my workers.properties file:
worker.list=portalworker1,portalworker2,portalbalancer
worker.portalbalancer.type=lb
worker.portalbalancer.balance_workers=portalworker1,portalworker2
worker.portalbalancer.sticky_session=True
# Application server 1 Portal application
worker.portalworker1.type=ajp13
worker.portalworker1.host=10.178.197.91
worker.portalworker1.port=8009
worker.portalworker1.lbfactor=1
# Application server 2 Portal application
worker.portalworker2.type=ajp13
worker.portalworker2.host=10.178.197.90
worker.portalworker2.port=8009
worker.portalworker2.lbfactor=1
The problem is that currently request is being sent to any of the application server (for eg. one request at application server 1 and the second request to application server 2) which will obv. won't work.
I have also checked mod_jk log in debug mode:
For 1st request
[Tue Dec 13 16:46:12.222 2011] [16097:47166030803776] [debug] get_most_suitable_worker::jk_lb_worker.c (946): searching worker for partial sessionid UH76jWj-q2yX39prlS-nBA**
[Tue Dec 13 16:46:12.222 2011] [16097:47166030803776] [debug] get_most_suitable_worker::jk_lb_worker.c (1001): found best worker portalworker2 (portalworker2) using method 'Request'
For 2nd request:
[Tue Dec 13 16:46:12.434 2011] [16100:47166030803776] [debug] get_most_suitable_worker::jk_lb_worker.c (946): searching worker for partial sessionid UH76jWj-q2yX39prlS-nBA**
[Tue Dec 13 16:46:12.434 2011] [16100:47166030803776] [debug] get_most_suitable_worker::jk_lb_worker.c (1001): found best worker portalworker1 (portalworker1) using method 'Request'
This also ensures that the sessionid's for 2 requset are same, still different workers are found.
Any idea what I am doing wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题是我没有在 server.xml 中为不同的应用程序服务器添加 jvmRoute 来区分这些服务器,并且 jboss-service.xml 文件中的 useJK 也没有设置为 true。
The problem was that I had not added jvmRoute in my server.xml for my different application server to differentiate these servers, and also useJK was not set to true in jboss-service.xml file.