HTTP Load Balancing - rdirect only if first worker fails using mod_jk

99封情书 提交于 2019-12-10 11:46:15

问题


I have used Apache HTTPD mod_jk and Tomcat for a high availability solution. Here is the workers.properties for it.

worker.list=myworker

worker.myworker1.port=8009
worker.myworker1.host=host1
worker.myworker1.type=ajp13
worker.myworker1.lbfactor=1

worker.myworker2.port=8009
worker.myworker2.host=host2
worker.myworker2.type=ajp13
worker.myworker2.lbfactor=1

worker.myworker.type=lb
worker.myworker.balance_workers=myworker1,myworker2
worker.myworker.sticky_session=True

Right now, the requests are equally distributed among the workers and applications are working fine. What I want is, all the requests must go to myworker1. Only if myworker1 is down, it should be redirected to myworker2.

Is there a way possible with mod_jk for this?


回答1:


  1. Redirect to myworker2 in case myworker1 fails
  2. Disable myworker2 for all the requests except for failover

These two lines must be added to your file

worker.myworker1.redirect=myworker2
worker.myworker2.activation=disabled

See: https://salonegupta.wordpress.com/2014/08/27/apache-load-balancer-setup-with-failover-mechanism/ for more information



来源:https://stackoverflow.com/questions/31017740/http-load-balancing-rdirect-only-if-first-worker-fails-using-mod-jk

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!