当前位置:网站首页>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>
边栏推荐
- [leetcode] wild card matching
- An error is reported in the process of using gbase 8C database: 80000305, host IPS long to different cluster. How to solve it?
- C language current savings account management system
- How to understand super browser? What scenarios can it be used in? What brands are there?
- shell脚本文件遍历 str转数组 字符串拼接
- COMSOL -- 3D casual painting -- sweeping
- 13.(地图数据篇)百度坐标(BD09)、国测局坐标(火星坐标,GCJ02)、和WGS84坐标系之间的转换
- MySQL statistical skills: on duplicate key update usage
- Basics - rest style development
- 12. (map data) cesium city building map
猜你喜欢

紫光展锐全球首个5G R17 IoT NTN卫星物联网上星实测完成

COMSOL--三维图形的建立

中非 钻石副石怎么镶嵌,才能既安全又好看?

Stop saying that microservices can solve all problems!
![[office] eight usages of if function in Excel](/img/ce/ea481ab947b25937a28ab5540ce323.png)
[office] eight usages of if function in Excel

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

pytorch训练进程被中断了

Modulenotfounderror: no module named 'scratch' ultimate solution

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

AutoCAD -- mask command, how to use CAD to locally enlarge drawings
随机推荐
Risc-v-qemu-virt in FreeRTOS_ Scheduling opportunity of GCC
12. (map data) cesium city building map
Summary of websites of app stores / APP markets
Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in
uboot的启动流程:
7 themes and 9 technology masters! Dragon Dragon lecture hall hard core live broadcast preview in July, see you tomorrow
高校毕业求职难?“百日千万”网络招聘活动解决你的难题
1.php的laravel创建项目
Advanced technology management - what is the physical, mental and mental strength of managers
pytorch训练进程被中断了
POJ 3176-Cow Bowling(DP||记忆化搜索)
MySQL statistical skills: on duplicate key update usage
【爬虫】wasm遇到的bug
How does redis implement multiple zones?
How to get a token from tokenstream based on Lucene 3.5.0
技术管理进阶——什么是管理者之体力、脑力、心力
12.(地图数据篇)cesium城市建筑物贴图
Zcmu--1390: queue problem (1)
中非 钻石副石怎么镶嵌,才能既安全又好看?
Open3D 欧式聚类