当前位置:网站首页>Redis sentinel mechanism
Redis sentinel mechanism
2022-07-04 08:07:00 【Mar, LiuNian】
List of articles
effect
Solve the problem of master-slave mode , Master slave switchover after master instance failure ( Will be promoted from the instance
Main example ), To ensure that the system is available
Monitor the running status of master-slave instances
While the master-slave instance is running , There is also a special redis The process is running ( sentry )
It is responsible for monitoring the master , From the running state of the instance ( The heartbeat detection : Respond to the sentry within the specified time )
If the instance does not respond within the specified time , Mark it as offline
If the primary instance does not respond within the specified time , Then start the master-slave switching process
Because a single sentinel may respond overtime due to its own network fluctuations or the pressure of the primary instance at that time , Misjudge the primary instance as offline ( Subjective offline ). So as to execute unnecessary master-slave switching logic . Therefore, sentinels are generally made into clusters , Judge whether the main instance is offline by obeying the majority ( Objective offline )
Select the main process
When the main instance is judged to be offline , Operation scoring mechanism
1. First exclude the offline from the instance
2. Exclude nodes that have been disconnected from the main instance for a certain number of times during the operation of the instance
3. Determine the priority of the slave instance ( Priority can be achieved by :slave-priority To configure ), High priority , Score high
4. Compare the ring buffer from the Library slave_repl_offset( This parameter is used to record the replication difference between the primary instance and the primary instance , When the main instance hangs ,master_repl_offset There will be no increase in , So from the example slave_repl_offset The bigger it is , The smaller the difference with the main instance ),slave_repl_offset The bigger it is , The higher the score
5. perform redis The default rule for : runID The smaller it is , The higher the score
After the above scoring process , After choosing the Lord
The sentry tells the master's information to other slave instances
From the instance through replicaof Synchronize with the new primary instance
The sentinel informs the client to connect to the new primary instance
边栏推荐
- L1-027 rental (20 points)
- Sports [running 01] a programmer's half horse challenge: preparation before running + adjustment during running + recovery after running (experience sharing)
- With excellent strength, wangchain technology, together with IBM and Huawei, has entered the annual contribution list of "super ledger"!
- Introduction to neural network (Part 2)
- How to improve your system architecture?
- 21个战略性目标实例,推动你的公司快速发展
- JVM -- class loading process and runtime data area
- Easy to understand: understand the time series database incluxdb
- 【Go基础】2 - Go基本语句
- Go h*ck yourself:online reconnaissance (online reconnaissance)
猜你喜欢
Devops Practice Guide - reading notes (long text alarm)
[C language] open the door of C
In the era of low code development, is it still needed?
Book list | as the technical support Party of the Winter Olympics, Alibaba cloud's technology is written in these books!
JVM中堆概念
User login function: simple but difficult
一文了解數據异常值檢測方法
Project 1 household accounting software (goal + demand description + code explanation + basic fund and revenue and expenditure details record + realization of keyboard access)
1. Kalman filter - the best linear filter
运动【跑步 01】一个程序员的半马挑战:跑前准备+跑中调整+跑后恢复(经验分享)
随机推荐
A method for detecting outliers of data
Flask 常用组件
Unity-Text上标平方表示形式+text判断文本是否为空
1. Kalman filter - the best linear filter
Tri des fonctions de traitement de texte dans MySQL, recherche rapide préférée
PHP converts seconds to timestamps - PHP
This monitoring system can monitor the turnover intention and fishing all, and the product page has 404 after the dispute appears
Application of isnull in database query
Sports [running 01] a programmer's half horse challenge: preparation before running + adjustment during running + recovery after running (experience sharing)
OKR vs. KPI 一次搞清楚这两大概念!
Blog stop statement
L1-024 the day after tomorrow (5 points)
Take you to master the formatter of visual studio code
神经网络入门(下)
团体程序设计天梯赛-练习集 L2-002 链表去重
L1-025 positive integer a+b (15 points)
zabbix监控系统部署
Leetcode 146. LRU 缓存
MySQL中的文本處理函數整理,收藏速查
Li Kou today's question -1200 Minimum absolute difference