redis sentinel基本命令与参数
1、redis基本命令
1)获取sentinel的状态
(1)info
查看sentinel的状态
(2)sentinel masters
获取sentinel中监控的所有master的节点
(3)sentinel master <master-name>
获取master-name节点redis的状态信息
(4)sentinel slaves <master-name>
获取master-name节点下所有的slaves的状态信息。
(5) SENTINEL get-master-addr-by-name
通过sentinel中的节点名获取其ip地址
2)添加或删除监控节点
(1)sentinel monitor <name> <ip> <port> <qrirum>
name: sentinel中节点的名字
port ip : 被监控的redis master实例
quorum : failover时,需要的法定人数。
(2)sentinel reset
重置redis name匹配制定的状态,包括正在failover的master。
该操作会删除该节点上的slave信息、已经发现和关联的sentinel节点信息。
sentinel将会重新发现sentinel和redis slave节点。
(3) sentinel remove <master-name>
删除master节点,sentinel不再监控该节点。
3)manual failover
(1)sentinel failover <master-name>
强制redis mater进行failover操作。
2、主观下线(Subjectively Down)和 客观下线(Objectively Down)
SDOWM: Objectively Down, 单个sentinel节点在down-after-milliseconds时间内没有收到redis masterping的有效回复,这个redis master进入SDOWN主观下线状态。
ODOWN: Objectively Down, 接收多个(>=quorum) sentinel节点的SDOWN的确认,这个redis master进入O_DOWN客观下线状态。O_DOWN将会触发sentinel leader执行fail-over。
3、sentinel fail-over参数
1)down-after-milliseconds
sentinel在down-after-milliseconds时间内没有收到ping的有效回复,那么认为objectively down。
sentinel set test01 down-after-milliseconds 30000 # 判断节点subjective down的时间,将触发fail-over。
2)failover-timeout
sentinel set test01 failover-timeout 60000 # 重新对该master执行failover的时间间隔
If a Sentinel voted another Sentinel for the failover of a given master, it will wait some time to try to failover the same master again.This delay is the failover-timeout you can configure in sentinel.conf. This means that Sentinels will not try to failover the same master at the same time, the first to ask to be authorized will try, if it fails another will try after some time, and so forth.
4、sentinel状态监测
1) redis的监测
sentinel会每隔1s向redis master/slave发送一个ping命令。
2)和其他sentinel的发现
redis通过每隔2s进行PUB/SUB redis master/slave中__sentinel:hello channel中的数据,来发现新的sentinel节点和slaves节点。
3)redis slaves更新
A Sentinel sends INFO commands to the masters and slaves every ten seconds in order to take a fresh list of connected slaves, the state of the master, and so forth.
5、sentinel quorum
可以通过sentinel monitor命令、sentinel set、或者在启动sentinel的时候在配置文件中设置某个master的进行failover的投票的法定人数。
实际上,也就是确认objectively down的法定人数,如果超有大于等于quorum个sentinel确认某个redis master出现SDOWN,那么redis maser进入ODOWN的状态。
在这之后,sentinel leader将会执行failover过程。
法定人数合理的设置:不能小于sentinel总节点数(N)的一半。
即,floor(n/2) + 1 <= quorum <= N
Quorum: the number of Sentinel processes that need to detect an error condition in order for a master to be flagged as ODOWN.
The failover is triggered by the ODOWN state.
Once the failover is triggered, the Sentinel trying to failover is required to ask for authorization to a majority of Sentinels (or more than the majority if the quorum is set to a number greater than the majority).http://mdba.cn/2015/08/19/redis-cluster%e5%88%9b%e5%bb%ba/
redis sentinel基本命令与参数的更多相关文章
- Redis Sentinel 高可用实现说明
背景: 前面介绍了Redis 复制.Sentinel的搭建和原理说明,通过这篇文章大致能了解Sentinel的原理和实现方法以及相关的搭建.这篇文章就针对Redis Sentinel的搭建做 ...
- Redis Sentinel机制与用法说明【转】
本文来自:https://segmentfault.com/a/1190000002680804 概述 Redis-Sentinel是Redis官方推荐的高可用性(HA)解决方案,当用Redis做Ma ...
- Redis Sentinel:集群Failover解决方案(转载)
本文转载自:http://shift-alt-ctrl.iteye.com/blog/1884370 文中的配置例子,还有failover过程中触发的订阅事件具有很好的参考价值. Redis sent ...
- Redis Sentinel机制与用法(一)
Sentinel spring 集群配置: 概述 Redis-Sentinel是Redis官方推荐的高可用性(HA)解决方案,当用Redis做Master-slave的高可用方案时,假如master宕 ...
- Redis Sentinel高可用架构
Redis目前高可用的架构非常多,比如keepalived+redis,redis cluster,twemproxy,codis,这些架构各有优劣,今天暂且不说这些架构,今天主要说说redis se ...
- redis高可用之REDIS SENTINEL
1. Redis主从配置 1.1. 设置主从复制 Master <= Salve 10.24.6.5:6379 <= 10.24.6.7:6379 1.2. 取消主从复制 1.3. ...
- Redis、Redis+sentinel安装(Ubuntu 14.04下Redis安装及简单测试)
Ubuntu下Redis安装两种安装方式: 1.apt-get方式 步骤: 以root权限登录,切换到/usr目录下. 接下来输入命令,apt-get install redis-server,如图: ...
- Redis Sentinel机制与用法
概述 Redis-Sentinel是Redis官方推荐的高可用性(HA)解决方案,当用Redis做Master-slave的高可用方案时,假如master宕机了,Redis本身(包括它的很多客户端)都 ...
- (转)基于Redis Sentinel的Redis集群(主从&Sharding)高可用方案
转载自:http://warm-breeze.iteye.com/blog/2020413 本文主要介绍一种通过Jedis&Sentinel实现Redis集群高可用方案,该方案需要使用Jedi ...
随机推荐
- VC++ 两种动态调整控件位置的方法(CButton设置为Radio形式会出现错误)
((CButton*)GetDlgItem(IDC_CHECK1))->MoveWindow(, cy - , , ); ((CButton*)GetDlgItem(IDC_CHECK2))-& ...
- 在php里写sql查询需要注意的事情
---恢复内容开始--- 今天往php里写了一条sql查询, $sql = "select * from videos where vuser=".$u: $ret = mysql ...
- SVN-修改已提交的日志
前提:服务器是Windows下的VisualSVN Server 1.在库的属性页面的Hooks选项卡下找到Pre-revision property change hook,2.双击修改其内容,具体 ...
- Redis(一)基础
Redis Remote Dictionary Server 远程字典服务器 功能 缓存(当空间达到限制时,可以按照一定规则,淘汰部分数据) 队列(支持阻塞式读取) 订阅/发布(可以将其做出聊天室) ...
- thinkphp model模块
1.获取系统常量信息的方法:在控制器DengLuController里面下写入下面的方法,然后调用该方法. public function test() { //echo "这是测试的&qu ...
- C++函数重载和函数模板
1.函数重载 这是小菜鸟写的一个例子. 函数重载应该注意以下几点: 1.1重载函数有类似的功能: 1.2只能以参数的类型(形参个数和类型)来重载函数, int max(int a,int b);flo ...
- Markdown syntax guide and writing on MWeb
Philosophy Markdown is intended to be as easy-to-read and easy-to-write as is feasible.Readability, ...
- iOS Core Animation之CALayer心得
使用CALayer的mask实现注水动画效果 Core Animation一直是iOS比较有意思的一个主题,使用Core Animation可以实现非常平滑的炫酷动画.Core animtion的AP ...
- 【转】 教大家防止Jar包被反编译
http://blog.csdn.net/zhengjingle/article/details/50833746 在需要放置编译的java类中加一个无用的class,然后再把class的名字修改了, ...
- 2016CCPC 合肥--最大公约数//每一年通向它的路上,多少人折戟沉沙,多少人功败垂成,有人一战成名,有人从头再来。
有这样一个有关最大公约数的函数:函数 f(x, y): { c=0 当 y>0: { c +=1 t = x % y x = y y = t } 返回 c * x * x} 给出三个正整数n,m ...