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. Net分布式系统之五:C#使用Redis集群缓存

    本文介绍系统缓存组件,采用NOSQL之Redis作为系统缓存层. 一.背景 系统考虑到高并发的使用场景.对于并发提交场景,通过上一章节介绍的RabbitMQ组件解决.对于系统高并发查询,为了提供性能减 ...

  2. 打水印 Imagename_biao是水印文件 ImgName是原图

    /** * 打水印 Imagename_biao是水印文件 ImgName是原图 * @param Imagename_biao * @param ImgName */ public static v ...

  3. windbg学习.formats--转换成各种进制

    .formats 命令在当前线程和进程上下文下对一个表达式或符号进行求值,并以多种数字格式显示出来. 0:002> .formats 000ad3a0 Evaluate expression: ...

  4. android_demo之生成颜色布局

    前面学习了动态生成表格,不单单是要动态生成控件,也同时生成一个事件. 接下来用个小小栗子去了解这个知识点. <LinearLayout xmlns:android="http://sc ...

  5. 调用SAP函数创建寄售退货订单的时候报错:业务对象 BUS2032 是销售订单,销售凭证类别 H 是退货。

    RE.KR订单类型用BAPI_CUSTOMERRETURN_CREATE 其他用BAPI_SALESORDER_CREATEFROMDAT2

  6. Android笔记之——消息Toast

    java: package com.example.myapplication;import android.support.v7.app.AppCompatActivity;import andro ...

  7. 处理sevenzipsharp 检查密码函数的Bug

    using (SevenZipExtractor extr = new SevenZipExtractor(tbPackagePath.Text, "www.pc6.com")) ...

  8. exception 'yii\base\ErrorException' with message 'Class 'MongoClient' not found'

    问题描述: 本来项目运行的好好的,搬了一次办公室(电脑主机一起搬的),第二天的时候就登录不了了. php版本和扩展没有改变,且没有修改任何配置,我尝试重启php5-fpm 服务,又重启nginx服务, ...

  9. Flyweight(享元)--对象结构型模式

    1.意图 运用共享技术有效地支持大量细粒度的对象. 2.动机 Flyweight模式描述了如何共享对象,使得可以细粒度地使用它们,而无需高昂的代价.flyweight是一个共享对象,它可以同时在多个场 ...

  10. ELK日志管理之——logstash配置语法

    Logstash 设计了自己的 DSL -- 有点像 Puppet 的 DSL,或许因为都是用 Ruby 语言写的吧 -- 包括有区域,注释,数据类型(布尔值,字符串,数值,数组,哈希),条件判断,字 ...