jedis集群常见的问题JedisClusterException: CLUSTERDOWN The cluster is down

报错如下所示,至今没有找到原因。求大神帮解答一下,是什么原因引发的报错,解决方案是什么?


redis.clients.jedis.exceptions.hk.JedisClusterException: CLUSTERDOWN The cluster is down at redis.clients.jedis.hk.Protocol.processError(Protocol.java:118) at redis.clients.jedis.hk.Protocol.process(Protocol.java:138) at redis.clients.jedis.hk.Protocol.read(Protocol.java:207) at redis.clients.jedis.hk.Connection.readProtocolWithCheckingBroken(Connection.java:285) at redis.clients.jedis.hk.Connection.getIntegerReply(Connection.java:210) at redis.clients.jedis.hk.Jedis.hset(Jedis.java:664) at redis.clients.jedis.hk.JedisCluster$24.execute(JedisCluster.java:306) at redis.clients.jedis.hk.JedisCluster$24.execute(JedisCluster.java:303) at redis.clients.jedis.hk.JedisClusterCommand.runWithRetries(JedisClusterCommand.java:60) at redis.clients.jedis.hk.JedisClusterCommand.runWithRetries(JedisClusterCommand.java:71) at redis.clients.jedis.hk.JedisClusterCommand.runWithRetries(JedisClusterCommand.java:86) at redis.clients.jedis.hk.JedisClusterCommand.runWithRetries(JedisClusterCommand.java:71) at redis.clients.jedis.hk.JedisClusterCommand.run(JedisClusterCommand.java:32) at redis.clients.jedis.hk.JedisCluster.hset(JedisCluster.java:302) at com.iclick.shard.CommonProgram.commonProgram(CommonProgram.java:57) at com.iclick.shard.ShardProgram0.run(ShardProgram0.java:43) at java.lang.Thread.run(Thread.java:745) redis.clients.jedis.exceptions.hk.JedisClusterException: CLUSTERDOWN The cluster is down at redis.clients.jedis.hk.Protocol.processError(Protocol.java:118) at redis.clients.jedis.hk.Protocol.process(Protocol.java:138) at redis.clients.jedis.hk.Protocol.read(Protocol.java:207) at redis.clients.jedis.hk.Connection.readProtocolWithCheckingBroken(Connection.java:285) at redis.clients.jedis.hk.Connection.getIntegerReply(Connection.java:210) at redis.clients.jedis.hk.Jedis.hset(Jedis.java:664) at redis.clients.jedis.hk.JedisCluster$24.execute(JedisCluster.java:306) at redis.clients.jedis.hk.JedisCluster$24.execute(JedisCluster.java:303) at redis.clients.jedis.hk.JedisClusterCommand.runWithRetries(JedisClusterCommand.java:60) at redis.clients.jedis.hk.JedisClusterCommand.runWithRetries(JedisClusterCommand.java:71) at redis.clients.jedis.hk.JedisClusterCommand.runWithRetries(JedisClusterCommand.java:86) at redis.clients.jedis.hk.JedisClusterCommand.runWithRetries(JedisClusterCommand.java:71) at redis.clients.jedis.hk.JedisClusterCommand.run(JedisClusterCommand.java:32) at redis.clients.jedis.hk.JedisCluster.hset(JedisCluster.java:302) at com.iclick.shard.CommonProgram.commonProgram(CommonProgram.java:57) at com.iclick.shard.ShardProgram0.run(ShardProgram0.java:43) at java.lang.Thread.run(Thread.java:745) redis.clients.jedis.exceptions.hk.JedisClusterException: CLUSTERDOWN The cluster is down at redis.clients.jedis.hk.Protocol.processError(Protocol.java:118) at redis.clients.jedis.hk.Protocol.process(Protocol.java:138) at redis.clients.jedis.hk.Protocol.read(Protocol.java:207) at 

代码如下:

public staticvoid main(String[]args) {

FileCount.splitFile(10);

Set set = new HashSet();

set.add(new HostAndPort("127.0.0.1", 7000));

set.add(new HostAndPort("127.0.0.1", 7001));

set.add(new HostAndPort("127.0.0.1", 7002));

set.add(new HostAndPort("127.0.0.1", 7003));

set.add(new HostAndPort("127.0.0.1", 7004));

set.add(new HostAndPort("127.0.0.1", 7005));

JedisCluster jedis =new JedisCluster(set, 5000, 1000);


BufferedReader reader =null;

try {

for (intcount_i = 0;count_i < 10;count_i++) {

String fileName = File.separator +"Users" + File.separator

+ "lishangrong" + File.separator +"xmo"

+ File.separator +"20150525_" +count_i;

File file =new File(fileName);

reader = new BufferedReader(new FileReader(file));

String tempString =null;

JSONObject json;

List label;

List gender;

List age;

// 一次读一行,读入null时文件结束

while ((tempString =reader.readLine()) !=null) {

json = new JSONObject();

label = new ArrayList();

gender = new ArrayList();

age = new ArrayList();

// 把当前行号显示出来

String[] split =tempString.split("\\s");

String cookie =split[0];

if (!split[1].split(",")[0].equals("N")) {

String[] lsbelList =split[1].split(",");

for (inti = 0;i <lsbelList.length;i++) {

// 标签?

label.add(lsbelList[i]);

}

}

// 性别

if (!split[2].equals("N")) {

gender.add(split[2]);

}

// 年龄

if (!split[3].equals("N")) {

age.add(split[3]);

}

json.put("label",label);

json.put("gender",gender);

json.put("age",age);

String jsonStr =json.toString();

jedis.hset("GROUP_" +cookie,"features",jsonStr);


}

json = null;

label = null;

gender = null;

age = null;

file.delete();

}

long l2 = System.currentTimeMillis();

System.out.println(l2 -l1);

} catch (Exceptione) {

e.printStackTrace(pw);

MailSend.mail_send(sw.toString());

} finally {

if (reader !=null) {

try {

reader.close();

} catch (IOExceptione1) {

}

}

}

}


你可能感兴趣的:(redis,java)