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<HostAndPort> set = new HashSet<HostAndPort>();
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
+ File.separator +"20150525_" +count_i;
File file =new File(fileName);
reader = new BufferedReader(new FileReader(file));
String tempString =null;
JSONObject json;
List<String> label;
List<String> gender;
List<String> age;
// 一次讀一行,讀入null時檔案結束
while ((tempString =reader.readLine()) !=null) {
json = new JSONObject();
label = new ArrayList<String>();
gender = new ArrayList<String>();
age = new ArrayList<String>();
// 把當前行號顯示出來
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) {
}
}
}
}