sentinel[1]->master: 发送指令:info \n 获取master状态 sentinel[1]->master: 建立cmd连接 note right of master: master记录的信息:\n master信息\nslaves信息\n当前master连接的sentinels note left of sentinel[1]: sentinel[1]记录的信息:\nmaster信息\nslaves信息\n当前master连接的sentinels note left of sentinel[1]: sentinel[1]向slaves发送info指令,\n获取slaves状态 # 此时又增加了一台哨兵 sentinel[2] sentinel[2]->master: 发送指令:info sentinel[2]->master: 建立cmd连接 note right of master: master更新记录的信息:\n当前master连接的sentinels note right of sentinel[2]: sentinel[2]记录的信息:\nmaster信息\nslaves信息\n当前master连接的sentinels note right of sentinel[2]: sentinel[2]向slaves发送info指令,\n获取slaves状态 sentinel[2]->sentinel[1]: 建立通道:publish / subscribe \n用于哨兵间数据同步 sentinel[1]->sentinel[2]: 发送指令:ping \n获取各个sentinel状态
通知阶段
1 2 3
sentinel[1]->master/slaves: publish sentnel: hello master/slaves->sentinel[1]: 返回状态信息 note left of sentinel[1]: 在哨兵间的publish/subscribe网络中\n发布master/slaves的状态信息
故障转移阶段
确认master下线流程:
1 2 3 4 5 6 7
sentinel[1]->master: 发送hello指令无响应 sentinel[1]->master: 连续发送hello指令 note left of sentinel[1]: sentinel[1]将master标记为:SRI_S_DOWN \n S_DOWN:主观下线 sentinel[1]->sentinel[2]: 通过哨兵间的发布/订阅通道\n向其他哨兵传播master下线信息\n SENTINEL is-master-down-by-addr\n服务器host,port,发起方,状态.... sentinel[2]->master: 向master连续发送hello指令 sentinel[2]->sentinel[1]: sentinel[2]通过哨兵间发布/订阅通道\n确认master下线信息 note right of sentinel[2]: 超过一定数量的哨兵认为master下线\n(数量在哨兵配置文件配置)\nmaster被标记为:SRI_O_DOWN\nO_DOWN:客观下线