I have 2 backend servers on the same network and 2 Tomcats on both machines with the same application. Additionally, I have a main machine where I load my app and which choses to which worker requests should go. The problem is that the Load Balancer machine always choses the second worker no matter what and when I manipulate with the application to make it not work on the second machine, I load the app on main machine and the app won't load even for the fact that worker1 is working, but when I close the Tomcat on the second machine it redirects the requests to the first worker and it works. How to make it work? Why it always choses the the second worker?
workers.properties:
worker.list=jkstatus,router
worker.jkstatus.type=status
worker.router.type=lb
worker.router.balance_workers=worker1,worker2
worker.router.method=B
worker.router.sticky_session=true
worker.template.type=ajp13
worker.template.lbfactor=1
worker.template.recovery_options=3
worker.template.socket_keepalive=true
worker.template.connection_pool_timeout=180
worker.worker1.reference=worker.template
worker.worker1.host=firstmachine.abc.com
worker.worker1.port=8009
worker.worker1.redirect=worker2
worker.worker2.reference=worker.template
worker.worker2.host=secondmachine.abc.com
worker.worker2.port=8009
worker.worker2.redirect=worker1