当前位置:网站首页>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 )
边栏推荐
- 【剑指Offer】52. 两个链表的第一个公共节点
- MIT科技评论2022年35岁以下创新者名单发布,含AlphaFold作者等
- How can you choose to work in the county after graduation?
- 大文件处理(上传,下载)思考
- 【机器学习】K-means聚类分析
- [Architecture] 1366- how to draw an excellent architecture diagram
- DeFi借贷协议机制对比:Euler、Compound、Aave和Rari Capital
- Rainbow Brackets 插件的快捷键
- Building a basic buildreoot file system
- K-line diagram must be read for quick start
猜你喜欢

Tubes响应性数据系统的设计与原理

Post penetration file system + uploading and downloading files

Rexroth hydraulic control check valve z2s10-1-3x/

Small Tools(3) 集成Knife4j3.0.3接口文档

Six pictures show you why TCP has three handshakes?

Word中添加代码块(转载)

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

JS from prototype chain to inheritance

Building a basic buildreoot file system

Spin lock exploration
随机推荐
K-line diagram interpretation and practical application skills (see position entry)
巴比特 | 元宇宙每日必读:未成年人打赏后要求退款,虚拟主播称自己是大冤种,怎么看待这个监管漏洞?...
Tencent cloud installs MySQL database
【机器学习】K-means聚类分析
Design and principle of tubes responsive data system
分布式机器学习:模型平均MA与弹性平均EASGD(PySpark)
Hyper-v:在虚拟网络中启用 SR-IOV
New research of HKUST & MsrA: about image to image conversion, finishing is all you need
NFT: 开启加密艺术时代的无限可能
[machine learning] K-means clustering analysis
Thinking on large file processing (upload, download)
新技能:通过代码缓存加速 Node.js 的启动
大文件处理(上传,下载)思考
Splitting.js文本标题缓慢加载js特效
Canvas cloud shape animation
Map collection
编译生成busybox文件系统
canvas云朵形状动画
5G商用三年,未来创新何去何从?
每日面试1题-如何防止CDN防护被绕过



