1. 有间隔的kill 两个主:
Connecting to 192.168.137.4:22...
Connection established.
Escape character is '^@]'.
Last login: Sat Mar 14 07:01:36 2020 from 192.168.137.1
node3:/root#ps -ef | grep redi
root 5517 1 0 07:02 ? 00:00:00 redis-server 192.168.137.4:7004 [cluster]
root 5574 1 0 07:03 ? 00:00:00 redis-server 192.168.137.4:7005 [cluster]
root 5788 5670 0 07:04 pts/1 00:00:00 grep redi
node3:/root#redis-cli -h 192.168.137.4 -p 7004 -c
192.168.137.4:7004> CLUSTER nodes
192.168.137.4:7004> CLUSTER nodes
191d7306b81ffa85b5837898562eb6bf1479122c 192.168.137.3:7002@17002 master - 0 1584140794753 22 connected 5461-10922
9809b72ec290d73d99a3e1b0d12c4c7bf8583c45 192.168.137.3:7003@17003 slave 1b83e27acd5235726aea44702526a8ca0ede9a48 0 1584140795774 23 connected
bf0edaba80c4f31e9b56101572d2a5ccc8aa145c 192.168.137.4:7005@17005 slave 191d7306b81ffa85b5837898562eb6bf1479122c 0 1584140795270 22 connected
1b83e27acd5235726aea44702526a8ca0ede9a48 192.168.137.2:7000@17000 master - 0 1584140794752 23 connected 0-5460
3c6510bd29af80703ae7c0be5a5884caaa60cd4e 192.168.137.2:7001@17001 slave a7287834bc7db37249614d23e06ed8f9a6c7b3d3 0 1584140794246 14 connected
a7287834bc7db37249614d23e06ed8f9a6c7b3d3 192.168.137.4:7004@17004 myself,master - 0 1584140794000 14 connected 10923-16383
杀掉 192.168.137.3:7002@17002,192.168.137.2:7000@17000 两个主节点
node2:/root/cluster/7003#redis-cli -h 192.168.137.3 -p 7002 -c info | grep role
role:master
node2:/root/cluster/7003#ps -ef | grep redis
root 2815 1 0 17:06 ? 00:00:03 redis-server 192.168.137.3:7002 [cluster]
root 2976 1 0 17:10 ? 00:00:01 redis-server 192.168.137.3:7003 [cluster]
root 2999 2697 0 17:14 pts/0 00:00:00 grep redis
node2:/root/cluster/7003#kill -9 2815
node2:/root/cluster/7003#ps -ef | grep redis
root 2976 1 0 17:10 ? 00:00:01 redis-server 192.168.137.3:7003 [cluster]
此时:
192.168.137.4:7004> CLUSTER nodes
191d7306b81ffa85b5837898562eb6bf1479122c 192.168.137.3:7002@17002 master,fail - 1584141031821 1584141031620 22 disconnected
9809b72ec290d73d99a3e1b0d12c4c7bf8583c45 192.168.137.3:7003@17003 slave 1b83e27acd5235726aea44702526a8ca0ede9a48 0 1584141045906 23 connected
bf0edaba80c4f31e9b56101572d2a5ccc8aa145c 192.168.137.4:7005@17005 master - 0 1584141044866 24 connected 5461-10922
1b83e27acd5235726aea44702526a8ca0ede9a48 192.168.137.2:7000@17000 master - 0 1584141046919 23 connected 0-5460
3c6510bd29af80703ae7c0be5a5884caaa60cd4e 192.168.137.2:7001@17001 slave a7287834bc7db37249614d23e06ed8f9a6c7b3d3 0 1584141046513 14 connected
a7287834bc7db37249614d23e06ed8f9a6c7b3d3 192.168.137.4:7004@17004 myself,master - 0 1584141042000 14 connected 10923-16383
再kill 192.168.137.2:7000@17000
node1:/root/cluster/7001#redis-server redis.conf
node1:/root/cluster/7001#ps -ef | grep redis
root 14206 1 0 06:06 ? 00:00:05 redis-server 192.168.137.2:7000 [cluster]
root 14242 1 0 06:06 ? 00:00:06 redis-server 192.168.137.2:7001 [cluster]
root 16566 14004 0 06:18 pts/1 00:00:00 grep redis
node1:/root/cluster/7001#kill -9 14206
node1:/root/cluster/7001#ps -ef | grep redis
root 14242 1 0 06:06 ? 00:00:06 redis-server 192.168.137.2:7001 [cluster]
root 16658 14004 0 06:18 pts/1 00:00:00 grep redis
192.168.137.4:7004> CLUSTER nodes
191d7306b81ffa85b5837898562eb6bf1479122c 192.168.137.3:7002@17002 master,fail - 1584141031821 1584141031620 22 disconnected
9809b72ec290d73d99a3e1b0d12c4c7bf8583c45 192.168.137.3:7003@17003 master - 0 1584141263111 26 connected 0-5460
bf0edaba80c4f31e9b56101572d2a5ccc8aa145c 192.168.137.4:7005@17005 master - 0 1584141262590 24 connected 5461-10922
1b83e27acd5235726aea44702526a8ca0ede9a48 192.168.137.2:7000@17000 master,fail - 1584141232871 1584141231730 23 disconnected
3c6510bd29af80703ae7c0be5a5884caaa60cd4e 192.168.137.2:7001@17001 slave a7287834bc7db37249614d23e06ed8f9a6c7b3d3 0 1584141261563 14 connected
a7287834bc7db37249614d23e06ed8f9a6c7b3d3 192.168.137.4:7004@17004 myself,master - 0 1584141260000 14 connected 10923-16383