Search code examples
spring-bootredisredisson

org.redisson.client.RedisNodeNotFoundException: Node: NodeSource hasn't been discovered yet


I am new to Redisson and I was trying to integrate the redisson + spring boot for distributed locks with the help of Redis cache.

I am getting below error:

org.redisson.client.RedisNodeNotFoundException: Node: NodeSource [slot=14577, addr=redis://10.150.77.93:6381, redisClient=null, redirect=MOVED, entry=null] hasn't been discovered yet. at org.redisson.connection.MasterSlaveConnectionManager.createNodeNotFoundFuture(MasterSlaveConnectionManager.java:612) ~[redisson-3.11.3.jar:3.11.3] at org.redisson.connection.MasterSlaveConnectionManager.connectionWriteOp(MasterSlaveConnectionManager.java:564) ~[redisson-3.11.3.jar:3.11.3] at org.redisson.command.RedisExecutor.getConnection(RedisExecutor.java:671) ~[redisson-3.11.3.jar:3.11.3] at org.redisson.command.RedisExecutor.execute(RedisExecutor.java:134) ~[redisson-3.11.3.jar:3.11.3] at org.redisson.command.RedisExecutor$2.run(RedisExecutor.java:273) ~[redisson-3.11.3.jar:3.11.3] at io.netty.util.HashedWheelTimer$HashedWheelTimeout.expire(HashedWheelTimer.java:668) ~[netty-common-4.1.25.Final.jar:4.1.25.Final] at io.netty.util.HashedWheelTimer$HashedWheelBucket.expireTimeouts(HashedWheelTimer.java:743) ~[netty-common-4.1.25.Final.jar:4.1.25.Final] at io.netty.util.HashedWheelTimer$Worker.run(HashedWheelTimer.java:471) ~[netty-common-4.1.25.Final.jar:4.1.25.Final] at java.lang.Thread.run(Thread.java:748) ~[na:1.8.0_161]

The Redis Cache is autoconfigured by Spring boot and I have configured the RedissonClient for master slave cluster.

@Configuration
public class RedissonConfiguration
{
   @Bean
   RedissonClient redissonClient(Config config)
   {
     return Redisson.create(config);
   }


  @Bean
  Config config()
  {
    Config config =  new Config();
    config.useMasterSlaveServers().setMasterAddress("redis://10.150.77.91:6381")
            .addSlaveAddress("redis://10.150.77.93:6382");
    return config;
}
}




 @Component
 public class TriggerHandler
 {
private static final Logger LOGGER = LoggerFactory.getLogger(TriggerHandler.class);


@Autowired
RedissonClient redissonClient;

@Async
public void triggerEvent(AsyncEventTriggerRequest eventTriggerRequest)
{


    String lockName = eventTriggerRequest.getTenantId().concat("lock");

    RLock lock = redissonClient.getLock(lockName);


    try
    {
        if(lock.tryLock(2,5, TimeUnit.SECONDS))
        {
            LOGGER.info("Lock has been Achieved for: {}", lockName);
        }
    }
    catch (InterruptedException e)
    {
        lock.forceUnlock();
        e.printStackTrace();
    }

    lock.unlock();

}
}

Why is it failing ? Does not Redisson auto confiures redis client for Redis ?


Solution

  • This error means that Redis node 10.150.77.93 is not discovered yet, since Redis cluster info doesn't contain any information about it.