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基本命令与参数的更多相关文章

  1. Redis Sentinel 高可用实现说明

    背景:      前面介绍了Redis 复制.Sentinel的搭建和原理说明,通过这篇文章大致能了解Sentinel的原理和实现方法以及相关的搭建.这篇文章就针对Redis Sentinel的搭建做 ...

  2. Redis Sentinel机制与用法说明【转】

    本文来自:https://segmentfault.com/a/1190000002680804 概述 Redis-Sentinel是Redis官方推荐的高可用性(HA)解决方案,当用Redis做Ma ...

  3. Redis Sentinel:集群Failover解决方案(转载)

    本文转载自:http://shift-alt-ctrl.iteye.com/blog/1884370 文中的配置例子,还有failover过程中触发的订阅事件具有很好的参考价值. Redis sent ...

  4. Redis Sentinel机制与用法(一)

    Sentinel spring 集群配置: 概述 Redis-Sentinel是Redis官方推荐的高可用性(HA)解决方案,当用Redis做Master-slave的高可用方案时,假如master宕 ...

  5. Redis Sentinel高可用架构

    Redis目前高可用的架构非常多,比如keepalived+redis,redis cluster,twemproxy,codis,这些架构各有优劣,今天暂且不说这些架构,今天主要说说redis se ...

  6. redis高可用之REDIS SENTINEL

    1. Redis主从配置 1.1. 设置主从复制 Master <= Salve 10.24.6.5:6379 <= 10.24.6.7:6379 1.2.   取消主从复制 1.3.   ...

  7. Redis、Redis+sentinel安装(Ubuntu 14.04下Redis安装及简单测试)

    Ubuntu下Redis安装两种安装方式: 1.apt-get方式 步骤: 以root权限登录,切换到/usr目录下. 接下来输入命令,apt-get install redis-server,如图: ...

  8. Redis Sentinel机制与用法

    概述 Redis-Sentinel是Redis官方推荐的高可用性(HA)解决方案,当用Redis做Master-slave的高可用方案时,假如master宕机了,Redis本身(包括它的很多客户端)都 ...

  9. (转)基于Redis Sentinel的Redis集群(主从&Sharding)高可用方案

    转载自:http://warm-breeze.iteye.com/blog/2020413 本文主要介绍一种通过Jedis&Sentinel实现Redis集群高可用方案,该方案需要使用Jedi ...

随机推荐

  1. Java 对文件的读取操作

    package pack; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; ...

  2. IBatis 简易框架搭建

    1.练习框架 ibatis主要dll介绍 IBatisNet.Common.dll 由DataAccess和DataMapper组成的共享程序集 IBatisNet.Common.Logging.Lo ...

  3. MySQL root密码找回

    以MySQL多实例为例,演示找回MySQL root的密码 1.关闭mysql服务 [root@mysql ~]# mysqladmin -uroot -poldboy123 -S /data/330 ...

  4. 国内最给力五大免费VPN商家

    国内有很多提供免费VPN的商家,水平也是参差不齐,有的用心服务,为客户提供优质免费VPN线路,进而赢得客户的信任.有的则对免费线路敷衍了事,只对付费线路“尽职尽责”,从而流失大量潜在VIP客户. 笔者 ...

  5. scrollview技巧

    一行 CGFloat buttonX = 0; CGFloat buttonY = 25; CGFloat buttonW = 37; CGFloat buttonH = 60; CGFloat ma ...

  6. 《西科软件》一个高级PHP工程师所应该具备的

    初次接触PHP,就为他的美所折服,于是一发不可收拾.很多面试,很多人员能力要求都有"PHP高级工程师的字眼",如果您真心喜欢PHP,并且您刚起步,那么我简单说说一个PHP高级工程师 ...

  7. ios -网络加载json和本地加载json

    1网络加载json的时候,要在模型的实现文件里写: - (void)setValue:(id)value forKey:(NSString *)key { } 2本地加载json的时候,要在模型的实现 ...

  8. Mac 终端命令大全

    目录操作 命令名 功能描述 使用举例 mkdir 创建一个目录 mkdir dirname rmdir 删除一个目录 rmdir dirname mvdir 移动或重命名一个目录 mvdir dir1 ...

  9. js之字符串操作

    1.字符串查找 var str = "source_content10"; if(str.indexOf("source_content") !== false ...

  10. c# long转 datetime

    ; DateTime start = , , , , , , DateTimeKind.Utc); DateTime date = start.AddMilliseconds(time).ToLoca ...