Redis 哨兵不会自动发现其他哨兵
Redis sentinel doesn't auto-discover other sentinels
我已将 redis 配置为主服务器和两个从服务器,每个服务器都在一个单独的盒子上。我在每个盒子上也有一个哨兵进程 运行。这是此处文档中描述的设置:
http://redis.io/topics/sentinel#example-2-basic-setup-with-three-boxes
每个哨兵都可以连接到我的主人,并且可以看到奴隶。他们能够独立检测主节点或从节点是否出现故障。问题是哨兵无法相互检测。
我已经验证每个哨兵都按预期向 __sentinel__:hello
频道发布了消息,但似乎其中 none 实际上正在接收来自其他哨兵的消息。
如何让哨兵看到对方?
在配置哨兵时,我配置了一次哨兵,然后将该配置文件复制到所有其他哨兵上。
在复制配置之前,我必须已经启动了 sentinel,它重新编写了配置文件,其 ID 如下:
sentinel myid c766a0df56e72eda48cea984
当我将文件复制到其他哨兵时,它导致他们每个人都有相同的 ID,这反过来又导致他们忽略来自自动发现的具有相同 ID 的任何消息。从每个配置文件中删除 myid 行并重新启动每个哨兵进程解决了这个问题。
在所有 redis-sentinel.conf 文件中具有相同的 myid
是一个问题,但我遇到了问题,即使我的 ID 不同(runid 在 sentinel master mymaster 结果中显示“” )
我的问题源于我的哨兵方式绑定到本地主机 (127.0.0.1) 和私有(或 public)IP
我相信发现的 IP 是 127.0.0.1(因为它是配置中的第一个)所以对于接收消息的其他哨兵来说,这意味着其他哨兵与它自己相同(即使它有不同的 myid)
文档说:
Before adding a new sentinel to a master a Sentinel always checks if there is already a sentinel with the same runid or the same address (ip and port pair). In that case all the matching sentinels are removed, and the new added.
设置 sentinel announce-ip <ip>
或删除到 127.0.0.1 的绑定命令修复了问题。
我已将 redis 配置为主服务器和两个从服务器,每个服务器都在一个单独的盒子上。我在每个盒子上也有一个哨兵进程 运行。这是此处文档中描述的设置:
http://redis.io/topics/sentinel#example-2-basic-setup-with-three-boxes
每个哨兵都可以连接到我的主人,并且可以看到奴隶。他们能够独立检测主节点或从节点是否出现故障。问题是哨兵无法相互检测。
我已经验证每个哨兵都按预期向 __sentinel__:hello
频道发布了消息,但似乎其中 none 实际上正在接收来自其他哨兵的消息。
如何让哨兵看到对方?
在配置哨兵时,我配置了一次哨兵,然后将该配置文件复制到所有其他哨兵上。
在复制配置之前,我必须已经启动了 sentinel,它重新编写了配置文件,其 ID 如下:
sentinel myid c766a0df56e72eda48cea984
当我将文件复制到其他哨兵时,它导致他们每个人都有相同的 ID,这反过来又导致他们忽略来自自动发现的具有相同 ID 的任何消息。从每个配置文件中删除 myid 行并重新启动每个哨兵进程解决了这个问题。
在所有 redis-sentinel.conf 文件中具有相同的 myid
是一个问题,但我遇到了问题,即使我的 ID 不同(runid 在 sentinel master mymaster 结果中显示“” )
我的问题源于我的哨兵方式绑定到本地主机 (127.0.0.1) 和私有(或 public)IP
我相信发现的 IP 是 127.0.0.1(因为它是配置中的第一个)所以对于接收消息的其他哨兵来说,这意味着其他哨兵与它自己相同(即使它有不同的 myid)
文档说:
Before adding a new sentinel to a master a Sentinel always checks if there is already a sentinel with the same runid or the same address (ip and port pair). In that case all the matching sentinels are removed, and the new added.
设置 sentinel announce-ip <ip>
或删除到 127.0.0.1 的绑定命令修复了问题。