gpt4 book ai didi

linux - Redis sentinel - 如何让服务器脱离循环?

转载 作者:IT王子 更新时间:2023-10-29 01:07:57 25 4
gpt4 key购买 nike

我有以下哨兵部署 - 3 个 redis 实例在不同的服务器上,每个服务器上有 3 个哨兵。

现在,我意识到当前的 master 没有太多内存,所以我停止了这个特定服务器上的 sentinel 和 redis 实例。并在新机器上进行了相同的设置。所以,我仍然有相同的部署,3 个 redis 实例和 3 个哨兵。

问题是,现在哨兵说,master 挂了,因为他们认为 master 是我删除的服务器。我应该怎么做才能告诉哨兵它不需要在循环中包含该服务器。

最佳答案

来自关于 Redis Sentinel 的文档,在 Adding or removing Sentinels 一章下:

Removing a Sentinel is a bit more complex: Sentinels never forget already seen Sentinels, even if they are not reachable for a long time, since we don't want to dynamically change the majority needed to authorize a failover and the creation of a new configuration number. So in order to remove a Sentinel the following steps should be performed in absence of network partitions:

  1. Stop the Sentinel process of the Sentinel you want to remove.
  2. Send a SENTINEL RESET * command to all the other Sentinel instances (instead of * you can use the exact master name if you want to reset just a single master). One after the other, waiting at least 30 seconds between instances.
  3. Check that all the Sentinels agree about the number of Sentinels currently active, by inspecting the output of SENTINEL MASTER mastername of every Sentinel.

进一步:

Removing the old master or unreachable slaves.

Sentinels never forget about slaves of a given master, even when they are unreachable for a long time. This is useful, because Sentinels should be able to correctly reconfigure a returning slave after a network partition or a failure event.

Moreover, after a failover, the failed over master is virtually added as a slave of the new master, this way it will be reconfigured to replicate with the new master as soon as it will be available again.

However sometimes you want to remove a slave (that may be the old master) forever from the list of slaves monitored by Sentinels.

In order to do this, you need to send a SENTINEL RESET mastername command to all the Sentinels: they'll refresh the list of slaves within the next 10 seconds, only adding the ones listed as correctly replicating from the current master INFO output.

关于linux - Redis sentinel - 如何让服务器脱离循环?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35699177/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com