Jedis cluster模式连接出现No more cluster attempts left

2023-10-21 11:50:24 浏览数 (1)

# Jedis cluster模式连接出现No more cluster attempts left

同事在测试环境jedis cluster模式出现redis.clients.jedis.exceptions.JedisClusterMaxAttemptsException: No more cluster attempts left.报错,找到我帮忙定位下问题

通过堆栈信息找到对应的源码位置redis.clients.jedis.JedisClusterCommand#runWithRetries

代码语言:javascript复制
  private T runWithRetries(final int slot, int attempts, boolean tryRandomNode, JedisRedirectionException redirect) {
    if (attempts <= 0) {
      throw new JedisClusterMaxAttemptsException("No more cluster attempts left.");
    }
    ...
  }

从源码中分析得到,在测试attempts次之后就会抛出No more cluster attempts left的异常,根据源码下文有两种异常会导致重试

  • JedisConnectionException:连接redis出现异常
  • JedisRedirectionException:redis重定向会抛出的异常,比如MOVE

在对应的位置打上断点,运行出现问题的接口,出现以下报错

问题就很明显了,ERR Client sent AUTH, but no password is set,意思是项目配置设置了密码,但是这个redis节点没有设置密码,是运维的同学漏配置了

0 人点赞