当前位置:网站首页>2022-01-27 redis cluster brain crack problem analysis
2022-01-27 redis cluster brain crack problem analysis
2022-07-03 12:55:00 【a tracer】
Catalog
cluster Cluster fault detection and master-slave switching :
redis-cluster The cause of the brain crack problem :
Brain fissure resolution strategy :
Abstract :
analysis redis-cluster Cluster pattern , Strategies to solve the problem of cerebral fissure
cluster Cluster fault detection and master-slave switching :
NDB.Redis- Data security -cluster colony
redis-cluster The cause of the brain crack problem :
Set the cluster to have cluster1, Including one master and one slave , master1 and slave1. client And master1 Connect .
At this time, there are two network partitions :
- client And master1 Network partition
- cluster The rest of the cluster master Node and master1 Network partition
Preconditions for the occurrence of cerebral fissure :
- cluster More than half of the cluster master node , And master1 Between nodes , Network disconnection occurs
- client And master1 Your network connection is normal
cluster More than half of the cluster master node , And master1 Between nodes , Network disconnection occurs :
Lead to :
- cluster Cluster decision master1 Get into FAIL state
- slave1 Received master1 Get into FAIL Broadcast of status , Start applying for master-slave switching voting
- slave1 By more than half of master The node voted , slave1 Begin to enter master state , And broadcast new master
- To the whole cluser For clusters , The original master1 It's offline , master The nodes are made up of slave1 Switch complete
- about cluster1 Come on , Now the latest data , It's from the original slave1 Provide
- For the original mastee1
- The original master1 The data of the node will be lost
- If cluster The cluster decides to go online again , Is judged to be slave state , From the original slave1 After the master-slave switch , Make a full copy slave1 The data of
client And master1 Your network connection is normal :
here client There are the following conditions :
- client Don't ask again cluster Cluster routing information in the cluster
- client And master1 The network channel of is normal
Lead to :
- client The data of continues to be written master1
- But for cluster colony , Determined master1 Get into FAIL state , And has elected a new master node
- Lead to client write in master1 Your data will be lost
Brain fissure resolution strategy :
A strategy : client Heartbeat detection update cluster Cluster information , Reduce and judge as FAIL Of master1 The connection time of
specific working means :
- client The role of is represented by the cluster proxy be responsible for
- To shorten the proxy Node query cluster Time period of routing table status
- slave node , and proxy Of the query cluster node , Received at the same time master1 Of FAIL State change
- slave Time of master-slave switching , Include
- cluster One in the cluster mater determine master1 by FAIL, Then broadcast the message , It is considered that all nodes receive master1 Get into FAIL The state of
- You need to proxy The time period of heartbeat detection < Time of master-slave switching
- To all the master Send a vote request - Time consuming :
- Accept more than half of master The vote of the corresponding - Time consuming :
- It's up to you to switch - Time consuming :
- proxy The time to query the routing table from the static node
- ClusterServerPool::RefreshInterval Configure query cycle , It can be accurate to us, Microsecond
Strategy two : master1 The node determines whether it has been connected with cluster Cluster network isolation , If isolated , Write is rejected
principle : master Judge whether you have not exchanged data with the slave node , If you haven't done data exchange for a long time , It is considered that this node has been cluster The cluster decides to go offline , Then this master The node refused to write
redis.conf Configuration properties of :
- min-replicas-to-write: master Nodes at least slave Number of nodes , otherwise master Write denied
- min-replicas-max-lag: master Nodes are at least related to slave Node data heartbeat ping Time , Beyond that time , be master Write denied
Use min-replicas-max-lag Configuration feasibility analysis :
explain : This configuration is made up of master Judgment and slave Copy time , To decide whether you can be written , So as to avoid being judged by the cluster FAIL when , Continue to the old master write in
The problem is :
- master Of FAIL State determination , And master The rejection of the node is written , Are different judgment paths
- master1 Get into FAIL, By cluster Others in the cluster master The node is responsible for determining
- master1 The node refused to write , It is master Node judgment and slave Node ping interval
- cluster When one master and one slave are deployed , Master slave switchover occurs when the master node fails , The new main node will refuse to write
- master Downtime ,slave Switch to a master, Now the new master No, slave
- Because no slave, Lead to min-replicas-max-lag The decision timed out , Lead to a new master Write denied , This leads to cluster Fragmentation is not available
Options :
- Client pass proxy When the connection , To shorten the proxy The period of querying the status of the cluster
- Client direct connection cluster Of master Node time , temporary (630 edition ) Don't deal with it
边栏推荐
- 启用MemCached的SASL认证
- Powerful avatar making artifact wechat applet
- [exercise 5] [Database Principle]
- Summary of error prone knowledge points: Calculation of define s (x) 3*x*x+1.
- 基于同步坐标变换的谐波电流检测
- Integer case study of packaging
- [exercice 7] [principe de la base de données]
- [data mining review questions]
- 2021 autumn Information Security Experiment 1 (password and hiding technology)
- The best shortcut is no shortcut
猜你喜欢

4. Wireless in vivo nano network: electromagnetic propagation model and key points of sensor deployment

Drop down refresh conflicts with recyclerview sliding (swiperefreshlayout conflicts with recyclerview sliding)

The upward and downward transformation of polymorphism

Analysis of a music player Login Protocol

Node.js: express + MySQL的使用

Harmonic current detection based on synchronous coordinate transformation

Public and private account sending prompt information (user microservice -- message microservice)

How to convert a decimal number to binary in swift

Attack and defense world mobile--ph0en1x-100

最新版抽奖盲盒运营版
随机推荐
Kung Fu pays off, and learning is done
Nodejs+express+mysql realizes login function (including verification code)
Export the entire Oracle Database
When the R language output rmarkdown is in other formats (such as PDF), an error is reported, latex failed to compile stocks Tex. solution
【習題五】【數據庫原理】
对业务的一些思考
GCN thinking - word2vec directly calculates text classification
C graphical tutorial (Fourth Edition)_ Chapter 17 generic: genericsamplep315
4. 无线体内纳米网:电磁传播模型和传感器部署要点
Openstack node address change
【计网】第三章 数据链路层(2)流量控制与可靠传输、停止等待协议、后退N帧协议(GBN)、选择重传协议(SR)
Xctf mobile--app1 problem solving
【ArcGIS自定义脚本工具】矢量文件生成扩大矩形面要素
Kotlin - 改良装饰者模式
强大的头像制作神器微信小程序
【数据库原理及应用教程(第4版|微课版)陈志泊】【第四章习题】
Solve the problem of VI opening files with ^m at the end
基于同步坐标变换的谐波电流检测
I'm too lazy to write more than one character
SQL learning notes (I)