赞
踩
遇到一个问题,因为是在测试环境,之前退出使用的kill -9暴力方式,再重新启动redis集群的时候,先并没有恢复rdb和aof,使用redis-cli客户端可以连接,说明集群已经启动来了,但是使用jedis客户端代码连接不上,抛异常:
Exception in thread "main" redis.clients.jedis.exceptions.JedisClusterException: CLUSTERDOWN The cluster is down
at redis.clients.jedis.Protocol.processError(Protocol.java:126)
at redis.clients.jedis.Protocol.process(Protocol.java:166)
at redis.clients.jedis.Protocol.read(Protocol.java:220)
at redis.clients.jedis.Connection.readProtocolWithCheckingBroken(Connection.java:318)
at redis.clients.jedis.Connection.getBinaryBulkReply(Connection.java:255)
at redis.clients.jedis.Connection.getBulkReply(Connection.java:245)
at redis.clients.jedis.Jedis.get(Jedis.java:181)
at redis.clients.jedis.JedisCluster$3.execute(JedisCluster.java:161)
at redis.clients.jedis.JedisCluster$3.execute(JedisCluster.java:158)
at redis.clients.jedis.JedisClusterCommand.runWithRetries(JedisClusterCommand.java:106)
at redis.clients.jedis.JedisClusterCommand.run(JedisClusterCommand.java:25)
at redis.clients.jedis.JedisCluster.get(JedisCluster.java:163)
at com.study.cache.JedisTest.main(JedisTest.java:17)
重启redis集群,重试不行,还是报相同的错;
把每个redis节点下面的rdb和aof都删除(如果是生产环境谨慎操作),重启redis集群,用jedis客户端代码也可以连接了,没有抛异常;
cd D:\Redis\Redis6379 redis-server.exe --service-stop --service-name Redis6379 redis-server.exe --service-stop --service-name Redis6380 redis-server.exe --service-stop --service-name Redis6381 redis-server.exe --service-stop --service-name Redis6382 redis-server.exe --service-stop --service-name Redis6383 redis-server.exe --service-stop --service-name Redis6384 redis-server.exe --service-start --service-name Redis6379 redis-server.exe --service-start --service-name Redis6380 redis-server.exe --service-start --service-name Redis6381 redis-server.exe --service-start --service-name Redis6382 redis-server.exe --service-start --service-name Redis6383 redis-server.exe --service-start --service-name Redis6384
代码正常运行
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。