由于上周总部机房停电,导致开发同事反馈某些组件无法连接,redis是其中之一。登入服务器发现redis未启动,启动redis-server node-7000.conf
指定配置文件,将各个节点启动后,查看集群状态如下:
[root@KMVS-CENTOS 7002]# redis-cli -p 7000 -h 10.1.6.148 cluster nodes
52a95c03f35ed8ae6aaf394420b17e91ae94c8ee :0 master,fail?,noaddr - 1596440973727 1596440973727 4 disconnected 0-5460
d50191a4664e852ddd88356000f24ebf03cc36b2 10.1.6.148:7002 slave 9d9df7843cb2be41f8809e86a6d344c047ca0b6d 0 1596441757808 5 connected
70bc1fd97c4f7183510bacd584adac3cd97143e7 10.1.6.148:7000 myself,slave c7002aea74d028bce50daf2a405311f0d23169fe 0 0 1 connected
9d9df7843cb2be41f8809e86a6d344c047ca0b6d :0 master,fail?,noaddr - 1596440973727 1596440973727 5 disconnected 10923-16383
9d7e47c2ea2afce549863af9fd5833a6ad6e0ec3 10.1.6.148:7001 slave 52a95c03f35ed8ae6aaf394420b17e91ae94c8ee 0 1596441759314 4 connected
c7002aea74d028bce50daf2a405311f0d23169fe :0 master,fail?,noaddr - 1596440973727 1596440973727 7 disconnected 5461-10922
发现149上的redis都是fail的(并未显示149的节点正常启动),但是查看进程也在。由此,便想重新加入集群,但发现报错。
[root@KMVS-CENTOS src]# ./redis-trib.rb create --replicas 1 10.1.6.148:7000 \
> 10.1.6.148:7001
> 10.1.6.148:7002
> 10.1.6.149:7003
> 10.1.6.149:7004
> 10.1.6.149:7005
>>> Creating cluster
[ERR] Node 10.1.6.148:7000 is not empty. Either the node already knows other nodes (check with CLUSTER NODES) or contains some key in database 0.
查看后说是需要删除节点下的aof, conf, rdb文件。各个节点删除后,重新启动redis,加入集群成功。
[root@KMVS-CENTOS src]# redis-cli -p 7000 -h 10.1.6.148 cluster nodes
ddd69a7f471fee9526716bb2966ef4e9ff4663ce 10.1.6.149:7004 master - 0 1596444268507 5 connected 10923-16383
7305f1e29a4738d01820abfe33d461533f6690bf 10.1.6.148:7002 slave ddd69a7f471fee9526716bb2966ef4e9ff4663ce 0 1596444269508 5 connected
4ffccbadd082ab7976dedf3b9e2d49ea05cb089a 10.1.6.149:7003 master - 0 1596444270010 4 connected 0-5460
17591f1e6e778f0732c8b918d9f8e0f4639478d5 10.1.6.148:7001 slave 4ffccbadd082ab7976dedf3b9e2d49ea05cb089a 0 1596444269009 4 connected
a6548cbc8c8fe89f774188240be15a339c5d4ecb 10.1.6.149:7005 slave 27ad2393a888357ebfd6cc31e4aac293fb61880d 0 1596444270010 6 connected
27ad2393a888357ebfd6cc31e4aac293fb61880d 10.1.6.148:7000 myself,master - 0 0 1 connected 5461-10922
网友评论