I have created a load balancing scenario in my machine and the same works fine. However, I am stuck at one simple issue and request help on the same.
I have two tomcat workers - worker1 and worker2. I also have a loadbalancer called balancer. workers.properties file has been created as follows -
- workers.tomcat_home="MyTomcatDirectory"
- workers.java_home="MyJDKDirectory"
- worker.list=tomcat1,tomcat2
- worker.list=balancer
- worker.tomcat1.type=ajp13
- worker.tomcat1.host=localhost
- worker.tomcat1.port=8009
- worker.tomcat1.lbfactor=1
- worker.tomcat2.type=ajp13
- worker.tomcat2.host=localhost
- worker.tomcat2.port=8019
- worker.tomcat2.lbfactor=1
- worker.balancer.type=lb
- worker.balancer.balance_workers=tomcat1,tomcat2
- worker.balancer.method=B`
Now, I have a webapp say webapp1 which is used by endusers extensively. I hence want that all the user requests for webapp1 should be handled by worker1. For this I have added the below lines in httpd.conf file in my apache's conf dir -
- JkMount / balancer
- JkMount /* balancer
- JkMount /webapp1 worker1
- JkMount /webapp1/* worker1
This works fine as well. The only problem here is that if tomcat1 (worker1) is down, the balancer doesn't direct the request for webapp1 to tomcat2 (worker2). How do I resolve this issue?