redis - redis哨兵故障转移后返回老主人
问题描述
我有 3 盒 redis sentinel 设置:
CLIENT (connects to S1)
|
↓
+----+
| M1 | us-east-1
| S1 |
+----+
|
+----+ | +----+
| R2 |----+----| R3 |
| S2 | | S3 |
+----+ +----+
us-east-2 us-west-2
M1 - Master
S1 - Sentinel 1
S2 - Sentinel 2
S3 - Sentinel 3
R2 - First slave (R=replica)
R3 - Second slave
在我的主人去世后,哨兵故障转移到 R2。我将 M1 带回联机(清除了一些磁盘空间),现在 M1 还活着并且很好,但它是 R2 的奴隶。是否有一种自动方式(或半自动方式)让 M1 再次成为主服务器,R2 成为 M1 的从属服务器,我的流量再次使用 M1 作为主 redis 实例?
本质上,我想恢复到故障转移之前的状态。
当前发生的情况是它选择 R2 作为主机并将其重新配置为:
CLIENT (connects to S1)
|
↓
+----+
|[R2]| us-east-2
| S2 |
+----+
|
+----+ | +----+
|[M1]|----+----| R3 |
| S1 | | S3 |
+----+ +----+
us-east-1 us-west-2
当我手动进行故障转移时,它会将 R3 提升为主服务器。(这是意料之中的)。
但是当我再次手动故障转移时,它会提升 R2,但我希望它会提升 M1。
所有连续的故障转移都在 R2 和 R2 之间轮换(同时始终保持 M1 作为其中任何一个的从属)。
我的 M1 从属优先级未指定,因此这意味着它的默认值是 100。我的 R2 从属优先级是 200,R2 是 300。这让我认为它应该旋转所有 3 个框,但它只旋转 R2 和 R3在初始故障转移之后。
这对我来说就像一个哨兵错误
解决方案
I think kiddorails's answer is correct, but most probably you have a similar problem as I had, where for some reason your original master is not replicating correctly.
Once I fixed my replication issue, I could cycle through my masters by issueing SENTINEL FAILOVER mymaster
. Initially it would just bounce between the two original slaves, but now that my original master is correctly replicating, it is cycling through all 3.
So I would recommend checking the replication of your original master after a failover. if you are sure it is working, you could also stop the other slave and then use the SENTINEL FAILOVER mymaster
command to force a failover to the original master. If that fails, you know there must be an issue with the replication.
推荐阅读
- python - Web 抓取 Python 脚本不会给出错误或结果。是请求问题还是 XPATH 问题?
- html - 类型错误:结果集不可调用 - BeautifulSoup
- angular - 模板解析错误:无法绑定到“showMePartially”,因为它不是“allrecords-app”的已知属性
- azure - 从 Azure 门户中删除 Azure DevOps 项目
- react-native - React-native-navigation:如何启动 Playground 应用程序?
- go - 去使用 fsnotify 监视文件已更改不起作用
- r - 使用带有空间多边形的特定变量进行传单映射
- amazon-web-services - ELB 是否提高了 AWS 架构的可用性?
- python - Python 重新导出另一个同名脚本
- tensorflow - 将具有多个输入的现有 keras 模型适配到 tensorflow 联合