当前位置:网站首页>Redis (VII) - sentry
Redis (VII) - sentry
2022-06-30 18:02:00 【Zhaoliwen is a pig】
Redis( 7、 ... and )—— sentry
List of articles
1、 brief introduction
sentry (sentinel) It's a Distributed systems , It's used to do... On each server in the master-slave structure monitor , In case of failure, through the voting mechanism choice new master And put all slave Connect to the new master.
2、 effect
- monitor
- Keep checking master and slave Is it working . master Survival tests 、master And slave Operation detection
- notice ( remind )
- When there is a problem with the monitored server , To the other ( The sentry room , client ) Sending notice .
- Automatic failover
- To break off master And slave Connect , Pick one slave As master, Will others slave Connect to the new master, And inform the client of the new server address
Be careful :
The sentry is also a redis The server , It just doesn't provide data services Usually, the number of sentinels is singular
3、 Deploy sentinels
Configure the master-slave structure of one drag two
Three sentries ( The configuration is the same , Different ports )
- see sentinel.conf
Activate the sentry
redis-sentinel sentinel Port number .conf

4、 working principle
Monitoring phase
- It is used to synchronize the status information of each node
- Get each sentinel The state of ( Whether online )
- obtain master The state of
- master attribute
- runid
- role:master
- each slave Details of
- master attribute
- Get all slave The state of ( according to master Medium slave Information )
- slave attribute
- runid
- role:slave
- master_host、master_port
- offset
- …
- slave attribute
[

Notification stage
- The Sentinels will get information synchronized with each other ( Information symmetry )
Fail over
confirm master Offline
- When a sentry finds that the main server is down , Will master Medium SentinelRedistance Medium master Change it to SRI_S_DOWN( Subjective offline ), And inform the other sentinels , Tell them they found master Hang up .
- Other sentinels receive the information sent by the sentinel , Will also try to connect master, If more than half ( In the configuration file ) confirm master After hanging up , Will master Medium SentinelRedistance Medium master Change it to SRI_O_DOWN( Objective offline )
Select sentinels to deal with
- Upon confirmation of master After hanging up , A sentinel will be selected for failover ( It is up to the sentry to specify which slave To make a new master).
- The filtering method is that sentinels send messages to each other , And vote , Those with more votes are elected .
Specific treatment
- The Sentinels chosen by him are responsible for the current slave Screening , The screening criteria are :
- Select the alternative from the server list master
- online
- Slow response
- And the original master Disconnected for a long time
- The principle of priority
- priority
- offset
- runid
- Send instructions ( sentinel )
- To the new master send out slaveof no one( Disconnect from the original master The connection of )
- To the other slave send out slaveof new masterIP port ( Let others slave With the new master Connected to a )
边栏推荐
- Add code block in word (Reprint)
- 【二叉树】前序遍历构造二叉搜索树
- leetcode:1042. Do not plant flowers adjacent to each other [randomly fill in qualified + no contradiction will be formed behind + set.pop]
- 基于SSM的新闻管理系统
- Daily interview 1 question - how to prevent CDN protection from being bypassed
- [zero basic IOT pwn] environment construction
- Nft: unlimited possibilities to open the era of encryption Art
- 【义修换届大礼包】
- 编写C语言的最简单小程序Hello world
- IEEE TBD SCI影响因子提升至4.271,位列Q1区!
猜你喜欢

Post penetration file system + uploading and downloading files

What will be the game changes brought about by the meta universe?

Generate confrontation network, from dcgan to stylegan, pixel2pixel, face generation and image translation.

China Infrastructure Development Association: electronic contract is recommended

Servlet operation principle_ API details_ Advanced path of request response construction (servlet_2)
![[zero basic IOT pwn] environment construction](/img/3b/a0689a1570fcc40bb9a5a4e9cdc63c.png)
[zero basic IOT pwn] environment construction

Analysis on the construction scheme and necessity of constructing expressway video monitoring platform

5G商用三年,未来创新何去何从?

JS from prototype chain to inheritance

Fragmentary knowledge points of MySQL
随机推荐
中基协:推荐使用电子合同
MIT科技评论2022年35岁以下创新者名单发布,含AlphaFold作者等
. Net ORM framework hisql practice - Chapter 1 - integrating hisql
MOOG servo valve d661-4577c
分享 5 大常用的特征选择方法,机器学习入门必看!!!
零基础也能做Apple大片!这款免费工具帮你渲染、做特效、丝滑展示
Exch:修复丢失的系统邮箱
Servlet operation principle_ API details_ Advanced path of request response construction (servlet_2)
Exploration and practice of "flow batch integration" in JD
【剑指Offer】52. 两个链表的第一个公共节点
Thinking on large file processing (upload, download)
Spin lock exploration
基于SSM的新闻管理系统
Generate confrontation network, from dcgan to stylegan, pixel2pixel, face generation and image translation.
What should I pay attention to when playing futures? Where is safe to open an account? It's my first contact
.NET ORM框架HiSql实战-第一章-集成HiSql
Nielseniq welcomes dawn E. Norvell, head of retail lab, to accelerate the expansion of global retail strategy
每日面试1题-如何防止CDN防护被绕过
Distributed machine learning: model average Ma and elastic average easgd (pyspark)
Radio and television 5g officially set sail, attracting attention on how to apply the golden band



