记一次redis-cluster的切换
# redis-cli -h 10.5.8.18 -c -p 8001 cluster nodes|grep master
6d2f817064a10631648f24f450a37237b3d53ff 10.5.8.13:8002@18002 master - 0 1514990543393 7 connected 0-5460
0d1d94c48bb9dbc119b5ed663a4e4a134e47d822 10.5.8.18:8002@18002 master - 0 1514990544393 6 connected 5461-10922
4a18014f2df6661653cd8def3be71dcd7ff32ae0 10.5.8.18:8001@18001 myself,master - 0 1514990544000 5 connected 10923-16383
# redis-cli -h 10.5.8.18 -c -p 8001 cluster nodes|grep slave
0e39ea84458223f93a18105841792a8df4c8cc16 10.5.10.12:8002@18002 slave 4a18014f2df6661653cd8def3be71dcd7ff32ae0 0 1514990551000 5 connected
905a1b8fcad08a765d86a3518d132223b9ff8b45 10.5.8.13:8001@18001 slave 0d1d94c48bb9dbc119b5ed663a4e4a134e47d822 0 1514990551402 6 connected
81061491460f1c00c2ff1ba8a481fed159a82825 10.5.10.12:8001@18001 slave d6d2f817064a10631648f24f450a37237b3d53ff 0 1514990552000 7 connected
确定复制关系:(有2个主在同一台主机上面,如果改主机宕机则会导致集群半数主节点不可用,从而导致集群不可用)
10.5.8.13:8002 --> 10.5.10.12:8001
10.5.8.18:8002 --> 10.5.8.13:8001
10.5.8.18:8001 --> 10.5.10.12:8002
slave节点上执行:(让该slave变成master)
redis-cli -h 10.5.10.12 -c -p 8002 cluster failover