W3Cschool
恭喜您成為首批注冊(cè)用戶(hù)
獲得88經(jīng)驗(yàn)值獎(jiǎng)勵(lì)
接上,此時(shí)master為2.129,找出redis實(shí)例的pid,然后kill:
[root@hadoop2 log]# ps -ef |grep redis-server
root 11349 1157 1 Jun18 ? 00:15:45 /usr/bin/redis-server 0.0.0.0:6379
root 14969 10433 0 08:33 pts/1 00:00:00 grep --color=auto redis-server
[root@hadoop2 log]# kill 11349
此時(shí)查看sentinel日志:
[1158] 19 Jun 08:33:57.953 # +sdown master mymaster 192.168.2.129 6379
[1158] 19 Jun 08:33:58.025 # +odown master mymaster 192.168.2.129 6379 #quorum 3/2
[1158] 19 Jun 08:33:58.025 # +new-epoch 31
[1158] 19 Jun 08:33:58.025 # +try-failover master mymaster 192.168.2.129 6379
[1158] 19 Jun 08:33:58.028 # +vote-for-leader 7d60ccf8a9f9f81e5292a0dbde2c54c76a2bd265 31
[1158] 19 Jun 08:33:58.036 # 192.168.2.130:26379 voted for 7d60ccf8a9f9f81e5292a0dbde2c54c76a2bd265 31
[1158] 19 Jun 08:33:58.037 # 192.168.2.128:26379 voted for 7d60ccf8a9f9f81e5292a0dbde2c54c76a2bd265 31
[1158] 19 Jun 08:33:58.105 # +elected-leader master mymaster 192.168.2.129 6379
[1158] 19 Jun 08:33:58.105 # +failover-state-select-slave master mymaster 192.168.2.129 6379
[1158] 19 Jun 08:33:58.183 # +selected-slave slave 192.168.2.128:6379 192.168.2.128 6379 @ mymaster 192.168.2.129 6379
[1158] 19 Jun 08:33:58.183 * +failover-state-send-slaveof-noone slave 192.168.2.128:6379 192.168.2.128 6379 @ mymaster 192.168.2.129 6379
[1158] 19 Jun 08:33:58.267 * +failover-state-wait-promotion slave 192.168.2.128:6379 192.168.2.128 6379 @ mymaster 192.168.2.129 6379
[1158] 19 Jun 08:33:59.039 # +promoted-slave slave 192.168.2.128:6379 192.168.2.128 6379 @ mymaster 192.168.2.129 6379
[1158] 19 Jun 08:33:59.040 # +failover-state-reconf-slaves master mymaster 192.168.2.129 6379
[1158] 19 Jun 08:33:59.104 * +slave-reconf-sent slave 192.168.2.130:6379 192.168.2.130 6379 @ mymaster 192.168.2.129 6379
[1158] 19 Jun 08:33:59.245 # -odown master mymaster 192.168.2.129 6379
[1158] 19 Jun 08:34:00.082 * +slave-reconf-inprog slave 192.168.2.130:6379 192.168.2.130 6379 @ mymaster 192.168.2.129 6379
[1158] 19 Jun 08:34:00.082 * +slave-reconf-done slave 192.168.2.130:6379 192.168.2.130 6379 @ mymaster 192.168.2.129 6379
[1158] 19 Jun 08:34:00.193 # +failover-end master mymaster 192.168.2.129 6379
[1158] 19 Jun 08:34:00.193 # +switch-master mymaster 192.168.2.129 6379 192.168.2.128 6379
[1158] 19 Jun 08:34:00.194 * +slave slave 192.168.2.130:6379 192.168.2.130 6379 @ mymaster 192.168.2.128 6379
[1158] 19 Jun 08:34:00.200 * +slave slave 192.168.2.129:6379 192.168.2.129 6379 @ mymaster 192.168.2.128 6379
[1158] 19 Jun 08:34:03.319 # +sdown slave 192.168.2.129:6379 192.168.2.129 6379 @ mymaster 192.168.2.128 6379
從日志中可以看出已經(jīng)切換到2.128,此時(shí)在2.128上看集群狀態(tài):
目前2.128為主,2.130為從,2.129上的redis宕掉。現(xiàn)在重啟2.129上的redis實(shí)例,啟動(dòng)后該節(jié)點(diǎn)會(huì)從原先的主變?yōu)閺模?duì)2.128進(jìn)行同步,最后達(dá)到同步狀態(tài):
查看redis.conf和redis-sentinel.conf,發(fā)現(xiàn)都被改寫(xiě)。
Copyright©2021 w3cschool編程獅|閩ICP備15016281號(hào)-3|閩公網(wǎng)安備35020302033924號(hào)
違法和不良信息舉報(bào)電話(huà):173-0602-2364|舉報(bào)郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號(hào)
聯(lián)系方式:
更多建議: