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 ...
随机推荐
- Git的基础
http://backlogtool.com/git-guide/cn/intro/intro2_3.html
- 2.springMVC+spring+Mybatis整合
前面已经说了,springMVC+spring+Mybatis的整合思路了,现在就照着这个思路来做一下: 在开始之前先来看一下工程的目录结构: config这个目录底下放的都是配置文件: mybati ...
- UVALive - 4513 Stammering Aliens ——(hash+二分 || 后缀数组加二分)
题意:找一个出现了m次的最长子串,以及这时的最右的位置. hash的话代码还是比较好写的,,但是时间比SA多很多.. #include <stdio.h> #include <alg ...
- iOS开发中多线程间关于锁的使用
为什么需要使用锁,当然熟悉多线程的你,自然不会感到陌生. 那你在代码中是否很好的使用了锁的机制呢?你又知道几种实现锁的方法呢? main.m 1 int main(int argc, const ch ...
- C语言正则表达式详解 regcomp() regexec() regfree()详解
标准的C和C++都不支持正则表达式,但有一些函数库可以辅助C/C++程序员完成这一功能,其中最著名的当数Philip Hazel的Perl-Compatible Regular Expression库 ...
- Java和.NET使用DES对称加密的区别
Java和.NET的系统类库里都有封装DES对称加密的实现方式,但是对外暴露的接口却各不相同,甚至有时会让自己难以解决其中的问题,比如Java加密后的结果在.NET中解密不出来等,由于最近项目有跨Ja ...
- ROW_NUMBER() OVER的用法
语法:ROW_NUMBER() OVER(PARTITION BY COLUMN ORDER BY COLUMN) //PARTITION 分割 一.ROW_NUMBER() OVER ...
- Apache伪静态在网站目录没有反斜杠后自动添加反斜杠
第一步:确认网站开启REWRITE规则 一般有两种情况: i.apache安装的时候已经包含rewrite功能 ii.后续配置的时候新添加mod_rewrite.so.这种情况需要在httpd.con ...
- nginx配置文件httpd.conf详解
PS:Nginx使用有两三年了,现在经常碰到有新用户问一些很基本的问题,我也没时间一一回答,今天下午花了点时间,结合自己的使用经验,把Nginx的主要配置参数说明分享一下,也参考了一些网络的内容,这 ...
- Linux secure boot(安全启动)时添加Nvidia显卡驱动
开启Secure boot情况下,在Fedora 21下安装Nvidia 显卡驱动的方法. Nvidia显卡驱动可以从官网上下载最新版>> 点击进入 下载后添加可执行权限: #chmod ...