赞
踩
2: [ERR] Node 192.168.10.32:7001 is not empty. Either the node already knows other nodes (check with CLUSTER NODES) or contains some key in database 0.
从redis单机版切换到redis集群(redis-cluster)后,
运行项目,牵扯到使用redis的部分报错:
- status: 500
-
- msg:
- redis.clients.jedis.exceptions.JedisClusterException: CLUSTERDOWN The cluster is down\n\tat redis.clients.jedis.Protocol.processError(Protocol.java:115)\n\tat
- redis.clients.jedis.Protocol.process(Protocol.java:142)\n\tat redis.clients.jedis.Protocol.read(Protocol.java:196)\n\tat
- redis.clients.jedis.Connection.readProtocolWithCheckingBroken(Connection.java:288)\n\tat redis.clients.jedis.Connection.getIntegerReply(Connection.java:213)\n\tat
- redis.clients.jedis.Jedis.hdel(Jedis.java:726)\n\tat redis.clients.jedis.JedisCluster$34.execute(JedisCluster.java:404)\n\tat
确定问题出在redis集群处,
到redis集群服务器重新创建集群时,报错
- [root@campusnetwork redis-cluster]# ./redis-trib.rb create --replicas 1 192.168.10.32:7001 192.168.10.32:7002 192.168.10.32:7003 192.168.10.32:7004 192.168.10.32:7005 192.168.10.32:7006
- >>> Creating cluster
- Connecting to node 192.168.10.32:7001: OK
- [ERR] Node 192.168.10.32:7001 is not empty. Either the node already knows other nodes (check with CLUSTER NODES) or contains some key in database 0.
那么可能和redis快照有关
dump.rdb文件:
dump.rdb是由Redis服务器自动生成的 默认情况下 每隔一段时间redis服务器程序会自动对数据库做一次遍历,把内存快照写在一个叫做“dump.rdb”的文件里,这个持久化机制叫做SNAPSHOT。有了SNAPSHOT后,如果服务器宕机,重新启动redis服务器程序时redis会自动加载dump.rdb,将数据库状态恢复到上一次做SNAPSHOT时的状态。
解决方法:
将每个节点下dump.rdb、nodes.conf本地备份文件删除
再执行脚本创建集群,成功!!!
运行集群运行项目,成功!!!
激动!!!
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。