Redis 3.2哨兵不工作

Redis 3.2 Sentinel not working

我的 Redis Sentinel 故障转移不起作用,当 master 完成后,没有进行握手,也没有发生故障转移;然而,sentinel 显示 master 何时恢复正常状态或何时关闭。我的 sentinel.conf 文件内容如下:

# Process Info
port 26379
daemonize yes
pidfile "/var/run/redis/sentinel.pid"

# Log files
loglevel notice
logfile "/var/log/redis/sentinel.log"

# Master setup
sentinel monitor mymaster 10.0.2.94 6379 2
sentinel auth-pass mymaster 118
sentinel down-after-milliseconds mymaster 10000
sentinel failover-timeout mymaster 60000
sentinel parallel-syncs mymaster 1

# Slave setup
sentinel monitor redis2 10.0.3.56 6379 2
sentinel auth-pass redis2 118
sentinel down-after-milliseconds redis2 15000
sentinel failover-timeout redis2 65000
sentinel parallel-syncs redis2 1

Redis.conf 文件非常标准,redis 工作正常。

我将非常感谢对此的任何帮助。

查看您发布的 conf 文件似乎设置错误您的集群名称有变体 mymasterredis2 尝试以下操作

# Process Info
port 26379
daemonize yes
pidfile "/var/run/redis/sentinel.pid"

# Log files
loglevel notice
logfile "/var/log/redis/sentinel.log"

# Master setup
sentinel monitor redis2 10.0.2.94 6379 2
sentinel auth-pass redis2 118
sentinel down-after-milliseconds redis2 10000
sentinel failover-timeout redis2 60000
sentinel parallel-syncs redis2 1

# Slave setup
sentinel monitor redis2 10.0.3.56 6379 2
sentinel auth-pass redis2 118
sentinel down-after-milliseconds redis2 15000
sentinel failover-timeout redis2 65000
sentinel parallel-syncs redis2 1

基本上集群名称必须相同。实际上,您可以在每个服务器上使用相同的哨兵 .conf 文件,这样更容易。