简体   繁体   English

Redis - 无法进行故障转移

[英]Redis - unable to failover

I have Master-Slave(3 nodes) setup using Redis Sentinel but when I try to do failover, I am seeing the below error我使用 Redis Sentinel 设置了主从(3 个节点),但是当我尝试进行故障转移时,我看到以下错误

127.0.0.1:26379> sentinel failover mymaster 
(error) NOGOODSLAVE No suitable replica to promote

Below is the Redis server configurations for master and slave nodes下面是主从节点的Redis服务器配置

#redis.conf of master node
bind 127.0.0.1 192.26.x.1
protected-mode no
daemonize yes
logfile /opt/softwares/redis-6.0.16/log/redis-server.log

#redis.conf of slave node 1
bind 127.0.0.1 192.26.x.2
protected-mode no
daemonize yes
logfile /opt/softwares/redis-6.0.16/log/redis-server.log
replicaof 192.26.x.1 6379

#redis.conf of slave node 2
bind 127.0.0.1 192.26.x.3
protected-mode no
daemonize yes
logfile /opt/softwares/redis-6.0.16/log/redis-server.log
replicaof 192.26.x.1 6379

Below is my sentinel nodes config下面是我的哨兵节点配置

# Same for all sentinel nodes
bind 127.0.0.1 192.26.x.1
protected-mode no
port 26379
daemonize yes
pidfile "/var/run/redis-sentinel.pid"
logfile "/var/log/redis-sentinel.log"
sentinel monitor mymaster 192.26.x.1 6379 2
sentinel down-after-milliseconds mymaster 5000
sentinel failover-timeout mymaster 60000

When I queried the slave's status, I can see master-related config are not defined.当我查询slave的状态时,我可以看到master相关的配置没有定义。

127.0.0.1:26379> SENTINEL masters
   31) "master-link-down-time"
   32) "0"
   33) "master-link-status"
   34) "err"
   35) "master-host"
   36) "?"
   37) "master-port"
   38) "0"

I am starting the Redis-servers in all nodes then Redis-sentinel.我在所有节点中启动 Redis-servers,然后是 Redis-sentinel。 Not sure the ordering of starting nodes matters.不确定起始节点的顺序是否重要。

Please let me know whether I am missing some configurations or doing something wrong.请让我知道我是否缺少某些配置或做错了什么。 The Redis version that I am using is 6.0.16.我使用的 Redis 版本是 6.0.16。

Thanks in advance.提前致谢。

Changing the order of IP addresses in a bind in all configuration files solved the issue ie在所有配置文件的绑定中更改 IP 地址的顺序解决了这个问题,即

bind <public_ip> <localhost>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM