redis
This commit is contained in:
@ -52,12 +52,11 @@ slaveof{newMasterIp} {newMasterPort}
|
||||
哨兵模式的主要作用在于它能够自动完成故障发现和故障转移,并通知客户端,从而实现高可用。哨兵模式通常由一组 Sentinel 节点和一组(或多组)主从复制节点组成,架构如下:
|
||||
|
||||
<div align="center"> <img src="../pictures/redis哨兵模式.png"/> </div>
|
||||
|
||||
### 2.1 架构说明
|
||||
|
||||
#### 1. Sentinel 与 Redis Node
|
||||
|
||||
Redis Sentinel 是一个特殊的 Redis 节点。在哨兵模式创建时,需要通过配置指定 Sentinel 与 Redis Master Node 之间的关系,然后 Sentinel 会从主节点上获取所有从节点的信息,之后 Sentinel 会定时向主节点和从节点发送`info`命令获取其拓扑结构和状态信息。
|
||||
Redis Sentinel 是一个特殊的 Redis 节点。在哨兵模式创建时,需要通过配置指定 Sentinel 与 Redis Master Node 之间的关系,然后 Sentinel 会从主节点上获取所有从节点的信息,之后 Sentinel 会定时向主节点和从节点发送`info`命令获取其拓扑结构和状态信息。
|
||||
|
||||
#### 2. Sentinel 与 Sentinel
|
||||
|
||||
@ -181,16 +180,13 @@ redis-sentinel sentinel-26381.conf
|
||||
使用 `ps -ef | grep redis` 命令查看进程,此时输出应该如下:
|
||||
|
||||
<div align="center"> <img src="../pictures/redis-sentinel-ps-ef.png"/> </div>
|
||||
|
||||
可以使用 `info replication` 命令查看 Redis 复制集的状态,此时输出如下。可以看到 6379 节点为 master 节点,并且有两个从节点,分别为 slave0 和 slave1,对应的端口为 6380 和 6381。
|
||||
|
||||
<div align="center"> <img src="../pictures/redis-info-replication.png"/> </div>
|
||||
|
||||
可以使用 `info Sentinel` 命令查看任意 Sentinel 节点的状态,从最后一句输出可以看到 Sentinel 节点已经感知到 6379 的 master 节点,并且也知道它有两个 slaves 节点;同时 Sentinel 节点彼此之间也感知到,共有 3 个 Sentinel 节点。
|
||||
|
||||
<div align="center"> <img src="../pictures/redis-sentinel-infomation.png"/> </div>
|
||||
|
||||
|
||||
## 参考资料
|
||||
|
||||
1. 付磊,张益军 . 《Redis 开发与运维》. 机械工业出版社 . 2017-3-1
|
||||
|
Reference in New Issue
Block a user