We have Redis master-slave setup, and we want to fallback to the slave once the master failed. But if it has failed it should never toggle back, even if the master is online again.

Is this possible?


There is a workaround to do what you need. Simply put a very high value on the rise parameter, and an inter of a few seconds, like the example below:

listen  sql-cluster
        balance roundrobin
        server  sql01 check backup
        server  sql02 check inter 5s fall 3 rise 99999999

In this example, sql01 is backup, and sql02 is active. If master is down, sql01 is up. For sql02 to return to active, it must do 99.999.999 healthy checks, with interval of 5 seconds... this is around 15 years!


Use the stick 🏑 option. From the official HAproxy blog:

Automatic failover without failback

The configuration below makes HAProxy to use s1 when available, otherwise fail over to s2 if available. When a failover has occurred, no failback will be processed automatically, thanks to the stick table:

backend bk_app
 stick-table type ip size 1 nopurge peers LB
 stick on dst
 server s1 check
 server s2 check backup

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.