redis集群重装问题解决

重装redis集群执行命令

redis-trib.rb create --replicas 0 192.168.1.221:7000 192.168.1.221:7001 192.168.1.221:7002

报错如下:

[ERR] Node 192.168.1.221:7000 is not empty. Either the node already knows other nodes (check with CLUSTER NODES) or contains some key in database 0.


解决如下:

停止redis集群进程,删除集群配置文件中生成的文件(截图中圈的文件)

再次运行集群创建命令,又报错,报错内容如下

ERR Slot 9962 is already busy (Redis::CommandError)

错误原因分析:

    slot插槽被占用了(这是搭建集群时,以前redis的旧数据和配置信息没有清理干净)

解决方案:

    用redis-cli 登录到每个节点执行  flushall  和 cluster reset

[root@localhost redis-3.2.4]# redis-cli -h 192.168.1.221 -c -p 7000
192.168.1.221:7000> flushall
OK
192.168.1.221:7000> cluster reset
OK
192.168.1.221:7000> quit
[root@localhost redis-3.2.4]# redis-cli -h 192.168.1.221 -c -p 7001
192.168.1.221:7001> flushall
OK
192.168.1.221:7001> cluster reset
OK
192.168.1.221:7001> quit
[root@localhost redis-3.2.4]# redis-cli -h 192.168.1.221 -c -p 7002
192.168.1.221:7002> flushall
OK
192.168.1.221:7002> cluster reset
OK
192.168.1.221:7002> quit

然后重新执行群集脚本命令:

redis-trib.rb create --replicas 0 192.168.1.221:7000 192.168.1.221:7001 192.168.1.221:7002

ok,成功重装。

猜你喜欢

转载自blog.csdn.net/qq_42714869/article/details/88536422