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

时间:2016-02-29 12:08:10

标签: linux redis redis-sentinel redis-server

我在不同的服务器上部署了Sentinel - 3个redis实例,每个服务器上都有3个标记。

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

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

1 个答案:

答案 0 :(得分:6)

有关Redis Sentinel的文档,请参阅Adding or removing Sentinels一章:

  

删除Sentinel有点复杂:Sentinels永远不会忘记已见过的Sentinels,即使它们长时间无法访问,因为我们不想动态更改授权故障转移和创建一个新的配置号。因此,为了删除Sentinel,应该在没有网络分区的情况下执行以下步骤:

     
      
  1. 停止要删除的Sentinel的Sentinel进程。
  2.   
  3. 向所有其他Sentinel实例发送internal override TInputOutput[] Sort() { // Step 1. Accumulate this partitions' worth of input. GrowingArray<TKey> sourceKeys = null; List<TInputOutput> sourceValues = null; BuildKeysFromSource(ref sourceKeys, ref sourceValues); Contract.Assert(sourceValues != null, "values weren't populated"); Contract.Assert(sourceKeys != null, "keys weren't populated"); // Step 2. Locally sort this partition's key indices in-place. QuickSortIndicesInPlace(sourceKeys, sourceValues, m_indexState); // Step 3. Enter into the merging phases, each separated by several barriers. if (m_partitionCount > 1) { // We only need to merge if there is more than 1 partition. MergeSortCooperatively(); } return m_sharedValues[m_partitionIndex]; } 命令(而不是*如果您只想重置一个主服务器,则可以使用确切的主名称)。一个接一个,在实例之间等待至少30秒。
  4.   
  5. 通过检查每个Sentinel的SENTINEL RESET *输出,检查所有Sentinels是否同意当前活动的Sentinel数量。
  6.   

此外:

  

删除旧的主服务器或无法访问的服务器。

     

哨兵永远不会忘记给定主人的奴隶,即使他们长时间无法到达。这很有用,因为Sentinels应该能够在网络分区或故障事件后正确地重新配置返回的从站。

     

此外,在故障转移之后,故障转移主服务器实际上被添加为新主服务器的从服务器,这样它将被重新配置为在新主服务器再次可用时立即复制。

     

但是,有时您希望永远从Sentinels监控的从属列表中删除一个从站(可能是旧主站)。

     

为了做到这一点,你需要向所有Sentinels发送SENTINEL MASTER mastername命令:他们将在接下来的10秒内刷新从属列表,只添加列出的正确复制的当前列表掌握SENTINEL RESET mastername输出。

相关问题