Skip to content

jedis-3.2.0 JedisClusterMaxAttemptsException connect to redis-5.0.7 cluster #2130

@DoverDee

Description

@DoverDee

Expected behavior

when kill 7000 master node , the code will appear exception,
wait a moment, the slave instead of 7000 master node, the exception should be disappear.
but still pose exception .

Java code

public static void clusterConnJedis() {
Set clusterNodes = new HashSet();
HostAndPort hp7000 = new HostAndPort("172.16.1.41", 7000);
HostAndPort hp7001 = new HostAndPort("172.16.1.41", 7001);
HostAndPort hp7002 = new HostAndPort("172.16.1.41", 7002);
HostAndPort hp7003 = new HostAndPort("172.16.1.41", 7003);
HostAndPort hp7004 = new HostAndPort("172.16.1.41", 7004);
HostAndPort hp7005 = new HostAndPort("172.16.1.41", 7005);
clusterNodes.add(hp7000);
clusterNodes.add(hp7001);
clusterNodes.add(hp7002);
clusterNodes.add(hp7003);
clusterNodes.add(hp7004);
clusterNodes.add(hp7005);
JedisCluster clusterPool = null;
while (true) {
try {
clusterPool = new JedisCluster(clusterNodes, 5000, new JedisPoolConfig());
int index = new Random().nextInt(100000);
String key = "k-" + index;
String value = "v-" + index;
clusterPool.set(key, value);
System.out.println("key:value=" + key + ":" + clusterPool.get(key));
TimeUnit.MILLISECONDS.sleep(500);
} catch (Exception e) {
e.printStackTrace();
} finally {
if (null != clusterPool) {
clusterPool.close();
}
}
}
}

Actual behavior and Steps to reproduce:

Redis cluster just installed and runing, run TestClass.clusterConnJedis(); in main method. everything is ok , I find the right pint key:value=k-RandomNum:v-RandomNum per 500 MILLISECONDS in conole.

But when I command ' kill -p ${hp7000_ pid}' , 7000 master node be killed. I find the console print
JedisClusterMaxAttemptsException several normal print intervals.
exception details:
redis.clients.jedis.exceptions.JedisClusterMaxAttemptsException: No more cluster attempts left.
at redis.clients.jedis.JedisClusterCommand.runWithRetries(JedisClusterCommand.java:86)
at redis.clients.jedis.JedisClusterCommand.runWithRetries(JedisClusterCommand.java:124)
at redis.clients.jedis.JedisClusterCommand.runWithRetries(JedisClusterCommand.java:124)
at redis.clients.jedis.JedisClusterCommand.runWithRetries(JedisClusterCommand.java:124)
at redis.clients.jedis.JedisClusterCommand.runWithRetries(JedisClusterCommand.java:124)
at redis.clients.jedis.JedisClusterCommand.runWithRetries(JedisClusterCommand.java:124)
at redis.clients.jedis.JedisClusterCommand.run(JedisClusterCommand.java:25)
at redis.clients.jedis.JedisCluster.set(JedisCluster.java:143)
at Test.clusterConnJedis(Test.java:69)
at Test.main(Test.java:11)
exception picture:
image

Redis / Jedis Configuration

see code clusterConnJedis()

Jedis version:

jedis-3.2.0

Redis version:

redis-5.0.7 cluster

Java version:

jdk1.8.0.211

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions