Redis-sentinel监控
Redis的
Sentinel 系统用于管理多个Redis服务器, 该系统执行以下三个任务:
监控(Monitoring)
提醒(Notification)
自动故障迁移(Automatic failover)
Sentinel
是一个分布式系统,可以在一个架构中运行多个 Sentinel 实例,使用流言协议(gossip protocols)来接收关于主服务器是否下线的信息, 并使用投票协议(agreement protocols)来决定是否执行自动故障迁移, 以及选择哪个从服务器作为新的主服务器。
启动Sentinel:
•通过redis-sentinel启动redis-sentinel /path/to/sentinel.conf
•通过redis-server启动redis-server /path/to/sentinel.conf--sentinel
Sentinel配置项
•sentinel announce-ip
<ip>•sentinel announce-port <port>•sentinel monitor <master-name>
<ip> <redis-port> <quorum>•sentinel auth-pass <master-name>
<password>•sentinel down-after-milliseconds
<master-name> <milliseconds>•sentinel parallel-syncs
<master-name> <numslaves>•sentinel failover-timeout
<master-name> <milliseconds>•sentinel notification-script
<master-name> <script-path>•sentinel client-reconfig-script
<master-name> <script-path>
1.Sentinel创建命令连接和订阅连接
sentinel与master、slave创建命令连接和订阅连接
sentinel与其他sentinel只创建命令连接
2.Sentinel发送消息
sentinel定期向master、slave发送INFO命令
sentinel定期向master、slave和sentinel发送ping命令
sentinel定期向master发送publish
hello命令hello:sentinel_ip,sentinel_port,sentinel_runid,current_epoch,
master_name,master_ip,master_port,master_config_epoch
3.Master下线检测
(1)
sentinel检测到master超时,标记为主观下线(2)
sentinel向其他sentinel询问master是否下线(3)
超过quorum数量的sentinel认为下线,标记master为客观下线(4)
sentinel进行投票选举leader




1.如果两个sentinel有一个sentinel断掉,另一个sentinel的选举leader将永远失败
2. sentinel不能识别slave中的127.0.0.1地址;
3.修改sentinel模式下的实例角色时,也需要修改sentinel和实例的配置;
4.被sentinel监控的slave,使用slaveof命令无效;
5. sentinel无法将slave当做master作为监控对象
6.
sentinel故障迁移中,slave重配超时后sentinel向其他slave发送的slaveof命令被丢弃
备注:
sentinel在执行故障迁移中,当被选中的slave升级为master后,其它slave需要重新配置到新master上,如果slave重配到新master超时,sentinel会向该slave发送slaveof命令将slave再次重新配置到新master上,并将命令放到待发缓冲中等待读写事件处理器处理,这时sentinel修改自己保持的实例状态将旧master实例切换到了新master实例,在切换过程中sentinel将slave实例释放掉(同时也释放了命令发送连接),导致之前发送的slaveof命令还没发送已经被清空。该slave只能等待sentinel通过INFO命令发现它的master不是新master时再次向它发送slaveof命令。
Redis-sentinel监控的更多相关文章
- redis sentinel 集群监控 配置
环境: ip 172.16.1.31 26379 redis sentinel ip 172.16.1.30 6379 主 1 ip 172.16.1.31 6380 从 1 ip ...
- 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 Sentinel哨兵集群
Redis Sentinel(哨兵集群)是一种高可用的redis部署方案.在集群中的redis-master服务挂掉时,无需人为干预,即可通过哨兵集群的自我调整,实现redis服务的持续可用. 哨兵集 ...
- 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 ...
- Redis的同步(主从复制)和Redis Sentinel
Redis的同步可以让其他服务器拥有一个不断更新的数据副本,从而使拥有数据副本的服务器可以处理客户端发出的读请求. 1.Redis同步的方法: 我们可以通过发送SLAVEOF host port命令来 ...
随机推荐
- Debian 安装下载工具软件
Debian 安装下载工具软件 1.下载BT种子Torrent文件 Linux下载种子文件肯定不能使用迅雷了,推荐一款叫做qBittorrent的P2P下载软件,目前在Ubuntu中使用很广泛,同样D ...
- Java字符串null相加
Java字符串null相加 最近和同事讨论了下面的一段代码: String a = null; a += a; System.out.println(a); 运行结果: nullnull 本着学习的态 ...
- MySQL数据库恢复的经历。
蛋疼,定时任务设置错误.把数据给删除了.还有一次是服务器时间不对,也把数据给删除了. 还好,开启了二进制日志,才算把数据找回,但是速度效率也太低. 痛定思变.在把一切交由电脑工作的时候,也要做好一定的 ...
- Linux下Find命令的使用
Find命令的一般形式为: findpathname-options[-print-exec-ok] pathname:find命令所查找的目录路径.例如用.来表示当前目录,用/来表示系统根目录. - ...
- Linux磁盘文件的命名
磁盘的常用接口有两种:IDE和SATA接口,目前主流的是SATA接口. IDE接口由IDE扁平电缆线连接,一个电缆可连接两个IDE接口,通常主机又都会提供两个IDE接口,因此最多可以接到四个IDE设备 ...
- 232. Implement Queue using Stacks
Implement the following operations of a queue using stacks. push(x) -- Push element x to the back of ...
- maven出错The folder is already a source folder
右键build path -> configure build path -> source ,选择 src/main/java.src/test/java删除,然后再新建.
- c++函数模板---3
原创博客:转载请标明出处:http://www.cnblogs.com/zxouxuewei/ 模板从大体上,可以分为两种:函数模板和类模板.函数模板是算法库的基础,类模板是建立标准库容器和迭代器的基 ...
- 防止 SQL 注入的方法(摘抄)
——选自<深入Ajax : 架构与最佳实践 = Advanced Ajax : architecture and best practices/ (美)Shawn M.Lauriat著:张过,宋 ...
- PS要点
1.通道 意味着我们同过不同的角度来看图像,可以得到不同的图像信息,PS是以灰度图像来表现这种信息的强弱. 我们能看到什么取决于我们的视角.任何灰度图像都可以按照不同的规则来构成彩色图像. 通道除了能 ...