question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

JedisCluster throws JedisClusterMaxRedirectionsException: Too many Cluster redirections?

See original GitHub issue

hi, i tested JedisCluster, it’s very very slow and throws an exception,

here is the code:

    Set<HostAndPort> nodes = new HashSet<HostAndPort>();
    nodes.add(new HostAndPort("192.168.2.65", 6379));
    nodes.add(new HostAndPort("192.168.2.65", 6380));
    nodes.add(new HostAndPort("192.168.2.65", 6381));
    nodes.add(new HostAndPort("192.168.2.65", 6382));
    nodes.add(new HostAndPort("192.168.2.65", 6383));
    nodes.add(new HostAndPort("192.168.2.65", 6384));
    JedisCluster jedisCluster = new JedisCluster(nodes, 30 * 2000);
    int k = 16384;
    for (int i = 0; i < k; i++) {
        long l = System.currentTimeMillis();
        jedisCluster.set(i + "", i + "" + i);
        System.out.println(i + " use " + (System.currentTimeMillis() - l));
    }
    jedisCluster.close();

and the exception:

Exception in thread “main” redis.clients.jedis.exceptions.JedisClusterMaxRedirectionsException:Too many Cluster redirections? at redis.clients.jedis.JedisClusterCommand.runWithRetries(JedisClusterCommand.java:34) at redis.clients.jedis.JedisClusterCommand.runWithRetries(JedisClusterCommand.java:67) at redis.clients.jedis.JedisClusterCommand.runWithRetries(JedisClusterCommand.java:83) at redis.clients.jedis.JedisClusterCommand.runWithRetries(JedisClusterCommand.java:67) at redis.clients.jedis.JedisClusterCommand.runWithRetries(JedisClusterCommand.java:83) at redis.clients.jedis.JedisClusterCommand.runWithRetries(JedisClusterCommand.java:67) at redis.clients.jedis.JedisClusterCommand.run(JedisClusterCommand.java:29) at redis.clients.jedis.JedisCluster.set(JedisCluster.java:70) at me.binge.redis.test.RedisClusterExecutorTest.main(RedisClusterExecutorTest.java:26)

test env:

  • Redis version: 3.0.0 stable
  • Jedis version: 2.7.0
  • It works fine when using Jedis.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:10

github_iconTop GitHub Comments

4reactions
zhiying8710commented, Apr 8, 2015

sorry, my bad. i found the reason, when i create the cluster, use command like this: ./redis-trib.rb create --replicas 1 127.0.0.1:6379 127.0.0.1:6381 127.0.0.1:6383 127.0.0.1:6380 127.0.0.1:6382 127.0.0.1:6383 then jedis get the cluster info, the ip of the node is also 127.0.0.1, so can’t get connection and retry. so i recreate the cluster use: ./redis-trib.rb create --replicas 1 192.168.2.65:6379 192.168.2.65:6381 192.168.2.65:6383 192.168.2.65:6380 192.168.2.65:6382 192.168.2.65:6384

it works.

0reactions
baiwfg2commented, Aug 24, 2017

There’s one thing I need to mention. Be sure to delete all aof, rdb, conf files before re-running redis-trib.rb

Read more comments on GitHub >

github_iconTop Results From Across the Web

JedisClusterMaxRedirectionsExc...
JedisClusterMaxRedirectionsException : Too many Cluster redirections? at redis.clients.jedis.JedisClusterCommand.
Read more >
JedisRedirectionException:Too many Cluster redirections
2. When we create a new JedisCluster, JedisCluster will create a JedisPool instance based on the ip and port we passed in (JedisPool...
Read more >
Redis Cluster fail-over issue. Slave to master promotion takes ...
JedisClusterMaxRedirectionsException : Too many Cluster redirections? at redis.clients.jedis.JedisClusterCommand.
Read more >
redis.clients.jedis.exceptions.JedisClusterException
nextSlot) { throw new JedisClusterException("No way to dispatch this command to ... new JedisClusterMaxRedirectionsException("Too many Cluster redirections?
Read more >
Developers - Exception in thread "main" redis.clients.jedis ...
Exception in thread "main" redis.clients.jedis.exceptions.JedisClusterMaxRedirectionsException: Too many Cluster redirections?
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found