Apache Http Download load balancing with mod_jk

I use apache http and mod_jk for load balancing. When using sticky sessions, if one of the tomcat instances dies, the request is successfully redirected to the other node. If for some reason the applications die, but tomcat is alive, then the requests continue to a node that has a dead application. Any ideas how to solve this?

Below you can evaluate the employee.properties file.

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 

Thanks!

+4
source share
2 answers

It usually gives a 404 error when the application is unavailable and tomcat is still running. I think there is a working directive for this, and this is fail_on_status , and you can use this for 404 error, and it may not be necessary to include the 503 error code with this directive, which probably means tomcat is stopped, and this is mod_jk working to go to another node resource. Try below workers.properties (the line attached to each employee) also for other error codes, separated by comma.

 worker.list=myworker worker.myworker1.port=8009 worker.myworker1.host=host1 worker.myworker1.type=ajp13 worker.myworker1.lbfactor=1 #worker.myworker1.fail_on_status=-404,503 worker.myworker1.fail_on_status=-404 worker.myworker2.port=8009 worker.myworker2.host=host2 worker.myworker2.type=ajp13 worker.myworker2.lbfactor=1 #worker.myworker2.fail_on_status=-404,503 worker.myworker2.fail_on_status=-404 worker.myworker.type=lb worker.myworker.balance_workers=myworker1,myworker2 worker.myworker.sticky_session=True worker.myworker.sticky_session_force=True 
+2
source

mod_jk cannot ping the url to resolve node health.

One solution is to use an external script that will do this for you, and if the application fails, it must restart the tomcat instance.

+1
source

Source: https://habr.com/ru/post/1384157/


All Articles