Mickey
Mickey

Reputation: 53

haproxy failover active-passive

i want to setup haproxy to switch to passive s2 after s1 fails but not to back to s1 when it gets healthy. i mean when switches to s2 if the s1 gets available, haproxy still send requests to s2 and s1 work as passive until failure of s1. haproxy configuration :

listen  http_web 192.168.1.3:80   
mode http
balance roundrobin
option httpchk
option forwardfor

    server server1 192.168.1.1:80 weight 1 maxconn 512 check backup
    server server2 192.168.1.2:80 weight 1 maxconn 512 check backup

i set backup for both servers but when s1 fails haproxy send requests to s2 but when s1 gets back available it sends requests to s1 again.

Upvotes: 1

Views: 1925

Answers (1)

Fliperman
Fliperman

Reputation: 1

round robin balancing mode, means that both servers will get requests one by one.

If you want persistence, you should use source method or add cookies.

Otherwise, if you don't need a load balacing feature and just active passive solution. You can use keepalived service ;)

Upvotes: 0

Related Questions