当前位置:网站首页>Redis sentinel mechanism and configuration process
Redis sentinel mechanism and configuration process
2022-07-21 22:49:00 【weixin_ forty-six million six hundred and eighty-five thousand 】
One . What is the sentinel mechanism
Redis The sentinel of (sentinel) The system is used to manage multiple Redis The server , The system performs the following three tasks :
- monitor (Monitoring): sentry (sentinel) Will keep checking your Master and Slave Is it working properly ( heartbeat ).
- remind (Notification): When someone is being monitored Redis When something goes wrong , sentry (sentinel) Can pass API Send notifications to administrators or other applications .
- Automatic failover (Automatic failover): When one Master When not working properly , Through the voting mechanism , Elect a new master.
sentry (sentinel) As a separate executable redis-sentinel , But actually it's just a Operating in special mode Redis The server .
Two . Sentinel mode configuration
1. preparation
Prepare three virtual machines , A mainframe , Two slaves . And both realize master-slave replication ( In my last article, I wrote how to configure redis Master-slave replication of )
2. Sentinel mode configuration
Both slaves are equipped with sentinels .
My host port number :192.168.137.68
Now configure the sentry of the first slave .( The second slave sentry configuration mimics the first , But change the slave name , For example mymaster1 Change it to mymaster2)
2.1 modify sentinel.conf The configuration file
sentinel monitor mymaster1 192.168.137.68 6379 1
# Master node name IP Port number The number of elections that the master server determines to be invalid requires at least 1 individual Sentinel agree!
sentinel auth-pass mymaster1 root
2.2 modify Sentinel The number of milliseconds it takes to think the server has been disconnected
sentinel down-after-milliseconds mymaster1 30 ( The original value is 30000 30 millisecond )
2.3 Configure how many slave servers synchronize the new master server at the same time
sentinel parallel-syncs mymaster1 2
2.4 Start sentinel mode
./redis-server ../sentinel.conf --sentinel &
Okay , Here, the sentry has been configured
3、 ... and . Verify sentry ( Kill the host , Slave host )
2.5 Kill the host master
Host operation :
see redis process :lsof -i:6379
Kill process :kill -9 redis Process number
2.6 Two slave machines vote ,30 After milliseconds, one of the slaves becomes the master .
1. One of them changes from slave to host
Check the process :lsof -i:6379
2. Check another slave
remarks :
1. There is no additional password problem in master-slave switching
Master Compared with the original configuration file, the configuration file needs to be modified in the following places
Slave Compared with the original configuration file, the configuration file needs to be modified in the following places
2. Stop sentinel mode
View process number :ps -aux | grep '6379'
Kill process : kill -9 Sentry progress number
边栏推荐
- 234. Palindrome linked list
- 力扣记录:动态规划4股票问题——121,122,123,188 ,309,714买卖股票的最佳时机(I,II,III,IV,含冷冻期,含手续费)
- Predicate 条件筛选
- 力扣记录:动态规划1基础题目——509 斐波那契数,70 爬楼梯,746 使用最小花费爬楼梯,62 不同路径,63 不同路径II,343 整数拆分,96 不同的二叉搜索树
- 第十一周ACM训练报告
- Take stones
- 可视化学习:可视化布局方法简介及优缺点
- XML explanation
- Directx11--窗口初始化(win32)
- 力扣记录:单调栈——739 每日温度,496 下一个更大元素I,503 下一个更大元素II,42 接雨水,84 柱状图中最大的矩形
猜你喜欢
438. Find all letter ectopic words in the string
Expression evaluation
Directx11--窗口初始化(win32)
Dx11---纹理与光照(火焰动画,纹理的旋转,贴不同的纹理)
Cocos creator 3.2 realizes the complete effect of 2D map 3D character 45 degree RPG game
STL preliminary understanding
Upgrade every day
110. Balanced binary tree
108. Convert an ordered array into a binary search tree
unity 锁定相机绕锁定目标的弧形运动
随机推荐
016: simple calculator
VisualStudio2019 配置点云库 PCL1.11.1+斯坦福兔子测试
437. Path sum III
第七周ACM训练报告
Atcoder beginer contest 218 problem solution
2022ACM夏季集训周报(二)
[oops framework] audio management
2021 popularization group summary
左倾堆的C#实现
Level 3 academic level test
n factorial
XML explanation
P2814 家谱(字符串并查集)
力扣记录:单调栈——739 每日温度,496 下一个更大元素I,503 下一个更大元素II,42 接雨水,84 柱状图中最大的矩形
第三周ACM训练报告
力扣记录:代码随想录总结
P1111 highway repair (and collection)
力扣记录:动态规划5子序列问题(3)回文——647 回文子串,516 最长回文子序列
unity 自定义小工具之“图片去除mipmap”
Dx11--用dx11绘制棱台,并用键盘和鼠标进行旋转缩放操作