Uploaded image for project: 'Spring Data Redis'
  1. Spring Data Redis
  2. DATAREDIS-898

RedisCommandExecutionException: MOVED error when used cluster configuration endpoint

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Works as Designed
    • Affects Version/s: 1.8.16 (Ingalls SR16)
    • Fix Version/s: None
    • Component/s: Lettuce Driver
    • Labels:
      None
    • Environment:
      AWS ElastiCache

      Description

      I'm using AWS ElastiCache (Redis) in cluster mode. I'm having two implementations to connect to ElastiCache. One of the implementations is directly using the native Lettuce driver and other using Spring data with Lettuce as underneath driver. AWS ElastiCache has Cluster configuration endpoint. I want to use this endpoint to connect to ElastiCache. I'm able to successfully connect to ElastiCache using cluster endpoint with native Lettuce driver implementation but getting below error when using spring data with cluster endpoint

      Note: It works when I use RedisClusterConfiguration with nodes endpoint but not with Cluster endpoint

      Spring data: 1.8.9-RELEASE (Using a higher version of Spring is not an option) 

      Lettuce: 4.5.0-FINAL

      Caused by: org.springframework.data.redis.RedisSystemException: 
      Error in execution; nested exception is com.lambdaworks.redis.RedisCommandExecutionException: 
      MOVED 12894 cache---.usw2.cache.amazonaws.com:6379 at org.springframework.data.redis.connection.lettuce.LettuceExceptionConverter.convert(LettuceExceptionConverter.java:50) 
      at org.springframework.data.redis.connection.lettuce.LettuceExceptionConverter.convert(LettuceExceptionConverter.java:48) 
      at org.springframework.data.redis.connection.lettuce.LettuceExceptionConverter.convert(LettuceExceptionConverter.java:41) 
       
      @Bean
      public LettuceConnectionFactory redisConnectionFactory() { 
         LettuceConnectionFactory lettuceConnectionFactory = new LettuceConnectionFactory(); 
         lettuceConnectionFactory.setHostName(<cluster_endpoint>); 
         lettuceConnectionFactory.setPort(); 
         lettuceConnectionFactory.setUseSsl(Boolean.valueOf(useSsl)); 
         return lettuceConnectionFactory; }
      
      @Bean
      public RedisTemplate<String, Object> redisTemplate() {
          RedisTemplate<String, Object> redisTemplate = new RedisTemplate<>();
          redisTemplate.setConnectionFactory(redisConnectionFactory());
          return redisTemplate;
      }
      

        Attachments

          Activity

            People

            • Assignee:
              mp911de Mark Paluch
              Reporter:
              pankajad Pankaj Dubey
              Last updater:
              Mark Paluch
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: