4

I want to configure Apache Web Server to meet the following requirement:

  • Access server1 while it's working.
  • Access server2 only when server1 does not respond. When server1 responds, access server1 again.

To do so, i tried configuring Apache Web Server (2.2) using mod_proxy_balancer. My problem is that session stickyness seems to be enabled by default. When server1 is not responding, the balancer redirects to server2, but when server1 recovers, the balancer does not access server1 until i clear sessions in my browser.

My balancer configuration:

ProxyPass /test balancer://mycluster
<Proxy balancer://mycluster>
    BalancerMember server1-url retry=10 loadfactor=100
    BalancerMember server2-url status=+H retry=10
</Proxy>

Is there any option to disable stickyness?

Thanks in advance.

xeeevi
  • 158
  • 8
  • Looks like you want to achieve High Availability and not Load Balancing. Why not use something like HAproxy to achieve Failover? – HariKrishnan Aug 17 '13 at 08:10

1 Answers1

2

You can do this with Mod_JK with below properties. Reference configuration can be found at Apache httpd 2.2.x + mod_jk 1.2.30 + tomcat 6 Error: Could not find worker with name 'XXXXX' in uri map post processing

# Disable Sticky Session
  worker.loadbalancer.sticky_session=0

# Define preferred failover node for worker1
  worker.worker1.redirect=worker2

# Disable worker2 for all requests except failover
  worker.worker2.activation=disabled
Community
  • 1
  • 1
KNOWARTH
  • 912
  • 7
  • 14