Today, while setting up Redis Sentinel, I kept getting stuck at -sdown sentinel, unable to perform automatic master-slave failover.
The configuration was as follows:
port 26379
daemonize yes
logfile "/home/redis/logs/sentinel.log"
sentinel announce-ip 192.168.0.201
sentinel monitor mymaster 192.168.0.201 6379 2
sentinel auth-pass mymaster Redis@jujinziben
sentinel down-after-milliseconds mymaster 15000
sentinel failover-timeout mymaster 900000
sentinel can-failover mymaster yes
sentinel parallel-syncs mymaster 1
After starting, it just hung there without progressing:
Later, I learned about Sentinel’s protected mode and changed it to the following:
port 26379
daemonize yes
protected-mode no
logfile "/home/redis/logs/sentinel.log"
sentinel announce-ip 192.168.0.201
sentinel monitor mymaster 192.168.0.201 6379 2
sentinel auth-pass mymaster Redis@jujinziben
sentinel down-after-milliseconds mymaster 15000
sentinel failover-timeout mymaster 900000
sentinel can-failover mymaster yes
sentinel parallel-syncs mymaster 1
After disabling protected mode and restarting the sentinel, it worked normally.