当前位置:网站首页>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>
边栏推荐
- Three suggestions for purchasing small spacing LED display
- C operation XML file
- Ffmpeg calls avformat_ open_ Error -22 returned during input (invalid argument)
- Unity xlua monoproxy mono proxy class
- OneForAll安装使用
- Differences between IPv6 and IPv4 three departments including the office of network information technology promote IPv6 scale deployment
- 11.(地图数据篇)OSM数据如何下载使用
- POJ 3176 cow bowling (DP | memory search)
- How does redis implement multiple zones?
- 7 themes and 9 technology masters! Dragon Dragon lecture hall hard core live broadcast preview in July, see you tomorrow
猜你喜欢

Evolution of multi-objective sorting model for classified tab commodity flow
![[crawler] bugs encountered by wasm](/img/29/6782bda4c149b7b2b334238936e211.png)
[crawler] bugs encountered by wasm

7.2每日学习4

AutoCAD -- mask command, how to use CAD to locally enlarge drawings

7 大主题、9 位技术大咖!龙蜥大讲堂7月硬核直播预告抢先看,明天见

11.(地图数据篇)OSM数据如何下载使用

How did the situation that NFT trading market mainly uses eth standard for trading come into being?

Detailed explanation of DDR4 hardware schematic design

Oneforall installation and use

7 themes and 9 technology masters! Dragon Dragon lecture hall hard core live broadcast preview in July, see you tomorrow
随机推荐
查看多台机器所有进程
Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in
spark调优(一):从hql转向代码
Manage multiple instagram accounts and share anti Association tips
Ffmpeg calls avformat_ open_ Error -22 returned during input (invalid argument)
ibatis的动态sql
SSL证书错误怎么办?浏览器常见SSL证书报错解决办法
Solve readobjectstart: expect {or N, but found n, error found in 1 byte of
2048游戏逻辑
Characteristics and electrical parameters of DDR4
Home office things community essay
百问百答第45期:应用性能探针监测原理-node JS 探针
高校毕业求职难?“百日千万”网络招聘活动解决你的难题
How to introduce devsecops into enterprises?
Leetcode 185 All employees with the top three highest wages in the Department (July 4, 2022)
How can edge computing be combined with the Internet of things?
MySQL statistical skills: on duplicate key update usage
C#实现WinForm DataGridView控件支持叠加数据绑定
COMSOL -- 3D casual painting -- sweeping
Lombok makes ⽤ @data and @builder's pit at the same time. Are you hit?