当前位置:网站首页>Redis集群(主从)脑裂及解决方案
Redis集群(主从)脑裂及解决方案
2022-07-05 11:31:00 【我们一直在路上】
1 集群脑裂
redis 的集群脑裂是指因为网络问题,导致 redis master 节点跟 redis slave 节点和 sentinel 集群处于不同的网络分区,此时因为 sentinel 集群无法感知到 master 的存在,所以将 slave 节点提升为master 节点。此时存在两个不同的 master 节点,就像一个大脑分裂成了两个。
集群脑裂问题中,如果客户端还在基于原来的 master 节点继续写入数据,那么新的 master 节点将无法同步这些数据,当网络问题解决之后,sentinel 集群将原先的master节点降为 slave 节点,此时再从新的 master 中同步数据,将会造成大量的数据丢失。

2 解决方案
redis的配置文件中,存在两个参数:
min-slaves-to-write 3 min-slaves-max-lag 10
- 第一个参数表示连接到master的最少slave数量
- 第二个参数表示slave连接到master的最大延迟时间
按照上面的配置,要求至少3个slave节点,且数据复制和同步的延迟不能超过10秒,否则的话master就会拒绝写请求,配置了这两个参数之后,如果发生集群脑裂,原先的master节点接收到客户端的写入请求会拒绝,就可以减少数据同步之后的数据丢失。
注意:较新版本的 redis.conf 文件中的参数变成了
min-replicas-to-write 3 min-replicas-max-lag 10
redis中的异步复制情况下的数据丢失问题也能使用这两个参数。
</article>
边栏推荐
- Spark Tuning (I): from HQL to code
- Three suggestions for purchasing small spacing LED display
- Evolution of multi-objective sorting model for classified tab commodity flow
- 12. (map data) cesium city building map
- Ffmpeg calls avformat_ open_ Error -22 returned during input (invalid argument)
- 【爬虫】charles unknown错误
- C # implements WinForm DataGridView control to support overlay data binding
- 7 themes and 9 technology masters! Dragon Dragon lecture hall hard core live broadcast preview in July, see you tomorrow
- -26374 and -26377 errors during coneroller execution
- R3live series learning (IV) r2live source code reading (2)
猜你喜欢

R3live series learning (IV) r2live source code reading (2)

Three suggestions for purchasing small spacing LED display

Evolution of multi-objective sorting model for classified tab commodity flow

NFT 交易市场主要使用 ETH 本位进行交易的局面是如何形成的?

IPv6与IPv4的区别 网信办等三部推进IPv6规模部署

技术管理进阶——什么是管理者之体力、脑力、心力

13.(地图数据篇)百度坐标(BD09)、国测局坐标(火星坐标,GCJ02)、和WGS84坐标系之间的转换

【Office】Excel中IF函数的8种用法

高校毕业求职难?“百日千万”网络招聘活动解决你的难题

Lombok makes ⽤ @data and @builder's pit at the same time. Are you hit?
随机推荐
Technology sharing | common interface protocol analysis
How can China Africa diamond accessory stones be inlaid to be safe and beautiful?
Go language learning notes - analyze the first program
MySQL statistical skills: on duplicate key update usage
R3live series learning (IV) r2live source code reading (2)
程序员内卷和保持行业竞争力
Codeforces Round #804 (Div. 2)
How did the situation that NFT trading market mainly uses eth standard for trading come into being?
AUTOCAD——遮罩命令、如何使用CAD对图纸进行局部放大
13. (map data) conversion between Baidu coordinate (bd09), national survey of China coordinate (Mars coordinate, gcj02), and WGS84 coordinate system
CDGA|数据治理不得不坚持的六个原则
Pytorch training process was interrupted
Ddrx addressing principle
How to introduce devsecops into enterprises?
XML parsing
Summary of thread and thread synchronization under window
Golang application topic - channel
技术管理进阶——什么是管理者之体力、脑力、心力
Harbor image warehouse construction
Web API configuration custom route