3

we have got 3 active Tomcat instances, the load should be distributed evenly amongst them (sticky sessions via jvmroute, ajp).

We also have got 3 failover Tomcat instances running. If one of the 3 active instances fails, one of the 3 failover instances should take over.

I would like to use Apache2 with a load balancing module in order to configure load balancing and failover.

Is it possible to achieve this within only one Apache2 instance?

I thought about a configuration like the one below, but I neither know if it would work, nor if it would be recommended to do it this way.

<Proxy balancer://Group1>
BalancerMember ajp://destination1 route=core1
BalancerMember ajp://destination4 route=core1 status=+H
</Proxy>

<Proxy balancer://Group2>
BalancerMember ajp://destination1 route=core2
BalancerMember ajp://destination4 route=core2 status=+H
</Proxy>

<Proxy balancer://Group3>
BalancerMember ajp://destination1 route=core3
BalancerMember ajp://destination4 route=core3 status=+H
</Proxy>

<Proxy balancer://loadbalancing>
BalancerMember balancer://Group1 route=core1
BalancerMember balancer://Group2 route=core2
BalancerMember balancer://Group3 route=core3
</Proxy>

ProxyPass / balancer://loadbalancing/ stickysession=JSESSIONID|jsessionid nofailover=On
ProxyPassReverse / balancer://loadbalancing/ nofailover=On
hey
  • 317
  • 1
  • 5
  • 14

1 Answers1

1

It basically works - but it seems to be impossible to use the loadbalancer target within a proxy block - hence, http://localhost has to be used.

<Proxy balancer://Group1>
  ProxySet failonstatus=503
  BalancerMember ajp://destination1 route=core1 ping=10
  BalancerMember ajp://destination4 route=core1 ping=10 status=+H
</Proxy>
<Proxy balancer://Group2>
  ProxySet failonstatus=503
  BalancerMember ajp://destination2 route=core2 ping=10
  BalancerMember ajp://destination5 route=core2 ping=10 status=+H
</Proxy>
<Proxy balancer://Group3>
  ProxySet failonstatus=503
  BalancerMember ajp://destination3 route=core3 ping=10
  BalancerMember ajp://destination6 route=core3 ping=10 status=+H
</Proxy>

<Proxy balancer://loadbalancing>
  ProxySet failonstatus=503
  BalancerMember http://localhost/Group1 route=core1 ping=10
  BalancerMember http://localhost/Group2 route=core2 ping=10
  BalancerMember http://localhost/Group3 route=core3 ping=10
</Proxy>

ProxyPass /Group1 balancer://Group1
ProxyPassReverse /Group1 balancer://Group1
ProxyPass /Group2 balancer://Group2
ProxyPassReverse /Group2 balancer://Group2
ProxyPass /Group3 balancer://Group3
ProxyPassReverse /Group3 balancer://Group3

ProxyPass / balancer://loadbalancer/ stickysession=JSESSIONID|jsessionid nofailover=on
ProxyPassReverse / balancer://loadbalancer/ nofailover=on
hey
  • 317
  • 1
  • 5
  • 14