W3Cschool
恭喜您成為首批注冊用戶
獲得88經(jīng)驗值獎勵
接上,此時master為2.129,找出redis實例的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
此時查看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,此時在2.128上看集群狀態(tài):
目前2.128為主,2.130為從,2.129上的redis宕掉?,F(xiàn)在重啟2.129上的redis實例,啟動后該節(jié)點會從原先的主變?yōu)閺?,并?.128進行同步,最后達到同步狀態(tài):
查看redis.conf和redis-sentinel.conf,發(fā)現(xiàn)都被改寫。
Copyright©2021 w3cschool編程獅|閩ICP備15016281號-3|閩公網(wǎng)安備35020302033924號
違法和不良信息舉報電話:173-0602-2364|舉報郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號
聯(lián)系方式:
更多建議: