查看Redis集群信息
guodong@sh-guodong src % redis-cli -p 7001 cluster nodes 5e94ae9b31b2029b2e881e9e302800941e1debcd 127.0.0.1:7004@17004 slave 5500c4ce07bbb0b9f0d10ade053a423fd319afa6 0 1648971894002 2 connected 9c807c577b336d3aa4c86b4c5c2da452d3e3383d 127.0.0.1:7005@17005 master - 0 1648971890958 4 connected 10923-16383 7f3d314fb9c504861dc2cbe767f63cfc78d30b8e 127.0.0.1:7002@17002 slave cb1cb00f48aab147d3dd3eef9e4b81b2c1226f9e 0 1648971892987 0 connected cb1cb00f48aab147d3dd3eef9e4b81b2c1226f9e 127.0.0.1:7001@17001 myself,master - 0 1648971892000 0 connected 0-5461 5500c4ce07bbb0b9f0d10ade053a423fd319afa6 127.0.0.1:7003@17003 master - 0 1648971892000 2 connected 5462-10922 ab84c1e455a92cfb4c49eb56b0f4197badea7b5b 127.0.0.1:7006@17006 slave 9c807c577b336d3aa4c86b4c5c2da452d3e3383d 0 1648971893000 4 connected
查看Redis进程
guodong@sh-guodong src % ps -ef|grep redis 501 72133 1 0 11:21上午 ?? 1:10.82 redis-server 127.0.0.1:7001 [cluster] 501 72389 1 0 11:21上午 ?? 1:10.31 redis-server 127.0.0.1:7002 [cluster] 501 72594 1 0 11:21上午 ?? 1:10.66 redis-server 127.0.0.1:7003 [cluster] 501 72891 1 0 11:22上午 ?? 1:10.31 redis-server 127.0.0.1:7004 [cluster] 501 73095 1 0 11:22上午 ?? 1:10.83 redis-server 127.0.0.1:7005 [cluster] 501 73216 1 0 11:22上午 ?? 1:09.53 redis-server 127.0.0.1:7006 [cluster] 501 16500 93357 0 3:45下午 ttys001 0:00.00 grep redis
杀死进程Redis-server3的进程
guodong@sh-guodong src % kill -9 72594
再次查看Redis进程信息
guodong@sh-guodong src % ps -ef|grep redis 501 72133 1 0 11:21上午 ?? 1:10.91 redis-server 127.0.0.1:7001 [cluster] 501 72389 1 0 11:21上午 ?? 1:10.40 redis-server 127.0.0.1:7002 [cluster] 501 72891 1 0 11:22上午 ?? 1:10.41 redis-server 127.0.0.1:7004 [cluster] 501 73095 1 0 11:22上午 ?? 1:10.93 redis-server 127.0.0.1:7005 [cluster] 501 73216 1 0 11:22上午 ?? 1:09.62 redis-server 127.0.0.1:7006 [cluster] 501 16690 93357 0 3:45下午 ttys001 0:00.00 grep redis
再次查看Redis集群信息,总结:可能要等一会儿Redis4才能成为master节点
guodong@sh-guodong src % redis-cli -p 7001 cluster nodes 5e94ae9b31b2029b2e881e9e302800941e1debcd 127.0.0.1:7004@17004 master - 0 1648972003442 6 connected 5462-10922 9c807c577b336d3aa4c86b4c5c2da452d3e3383d 127.0.0.1:7005@17005 master - 0 1648972002000 4 connected 10923-16383 7f3d314fb9c504861dc2cbe767f63cfc78d30b8e 127.0.0.1:7002@17002 slave cb1cb00f48aab147d3dd3eef9e4b81b2c1226f9e 0 1648972002451 0 connected cb1cb00f48aab147d3dd3eef9e4b81b2c1226f9e 127.0.0.1:7001@17001 myself,master - 0 1648972000000 0 connected 0-5461 5500c4ce07bbb0b9f0d10ade053a423fd319afa6 127.0.0.1:7003@17003 master,fail - 1648971941557 1648971934000 2 disconnected ab84c1e455a92cfb4c49eb56b0f4197badea7b5b 127.0.0.1:7006@17006 slave 9c807c577b336d3aa4c86b4c5c2da452d3e3383d 0 1648972004455 4 connected