赞
踩
遇到一个问题,因为是在测试环境,之前退出使用的kill -9暴力方式,再重新启动redis集群的时候,先并没有恢复rdb和aof,使用redis-cli客户端可以连接,说明集群已经启动来了,但是使用jedis客户端代码连接不上,抛异常:
1、异常信息:
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)
2、在网上找了一下原因,可能是之前配置文件开启了 protected-mode yes,现在都改为 no;
3、重启redis集群,重试不行,还是报相同的错;
4、把每个redis节点下面的rdb和aof都删除(如果是生产环境谨慎操作),重启redis集群,用jedis客户端代码也可以连接了,没有抛异常;
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。