1

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?

aksappy
  • 3,400
  • 3
  • 23
  • 49

1 Answers1

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

pvpks
  • 351
  • 1
  • 8
  • This solution still works fine (2018, Tomcat 8, current mod_jk). In my case, I have two workers and wanted to set each other as a backup, disregarding the second line of the solution still makes the system work as intended (When one worker goes down, the others gets the intended payload). – Shawn Mar 26 '18 at 18:40