配置如下:
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
结果启动后一直卡在那边不动:
后来了解到sentinel的保护模式,改成如下:
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
关掉保护模式后重新启动哨兵正常。