LuJia__
LuJia__
采纳率100%
2015-08-26 02:26 阅读 11.3k

redisCluster Too many Cluster redirections 问题

redis版本 3.1,centos6.5 7个节点 3主4从

在linux 上用命令可以在节点1上取到节点2的数据

节点检查都正常

jedis-2.7.3 版本的JedisCluster

如下

  Set<HostAndPort> jedisClusterNodes = new HashSet<HostAndPort>();  
     jedisClusterNodes.add(new HostAndPort("123.57.249.203", 7000));  //换成7002就可以访问到了
     jc = new JedisCluster(jedisClusterNodes);  
    String string = jc.get("name");
System.out.println(string);             

key为name的值是时在7002端口的节点上
运行如下
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:68)
at redis.clients.jedis.JedisClusterCommand.runWithRetries(JedisClusterCommand.java:85)
at redis.clients.jedis.JedisClusterCommand.runWithRetries(JedisClusterCommand.java:68)
at redis.clients.jedis.JedisClusterCommand.runWithRetries(JedisClusterCommand.java:85)
at redis.clients.jedis.JedisClusterCommand.runWithRetries(JedisClusterCommand.java:68)
at redis.clients.jedis.JedisClusterCommand.run(JedisClusterCommand.java:29)
at redis.clients.jedis.JedisCluster.get(JedisCluster.java:96)
at jarSourse.test.TestRedis.testBenchRedisSet(TestRedis.java:21)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)

但是将端口换成7002就可以访问到数据了

这是什么原因这不是集群吗 不是应该可以访问到所有节点上的数据吗?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

3条回答 默认 最新

  • 已采纳
    oyljerry oyljerry 2015-08-26 02:56
    点赞 1 评论 复制链接分享
  • hwm_life Sandy 2015-11-28 13:39

    看看你的conf文件是不是用127.0.0.1,如果是的话需要改为服务器IP地址,这样测试才不会报

    点赞 3 评论 复制链接分享
  • wotangxing 聂安磊 2018-12-27 13:12

    除了以上ip的原因,要是还有这个问题
    jc = new JedisCluster(jedisClusterNodes);

    改为,假设连接数
    JedisCluster cluster = new JedisCluster(nodes,5000,1000);

    点赞 1 评论 复制链接分享

相关推荐