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?
Server Fault is a question and answer site for system and network administrators. It only takes a minute to sign up.Sign up to join this community
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 0.0.0.0:1433 balance roundrobin server sql01 192.168.100.109:1433 check backup server sql02 192.168.100.180:1433 check inter 5s fall 3 rise 99999999
In this example,
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!
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 10.0.0.1:80 check server s2 10.0.0.2:80 check backup