Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 3 down vote accepted

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, 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!

share|improve this answer

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 10.0.0.1:80 check
 server s2 10.0.0.2:80 check backup
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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