简体   繁体   中英

Disable stickyness on apache mod_proxy_balancer

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM