Search code examples
javaspringredissentinelspring-data-redis

Does Spring Data Redis (1.3.2.RELEASE) support JedisSentinelPool of jedis?


Does Spring Data Redis (1.3.2.RELEASE) support JedisSentinelPool of jedis?

Maybe it doesn't support,who will give me an answer?

If it doesn't support,how should I do?


Solution

  • Support for Redis Sentinel is added to Spring Data Redis 1.4. It will be in the upcoming Evans RC1, allowing configuration of JedisConnectionFactory to make use of JedisSentinelPool.

    RedisSentinelConfiguration sentinelConfig = new RedisSentinelConfiguration()
      .master("mymaster")
      .sentinel("127.0.0.1", 26379)
      .sentinel("127.0.0.1", 26380);
    
    JedisConnectionFactory factory = new JedisConnectionFactory(sentinelConfig);
    factory.afterPropertiesSet();
    

    You can already have a look at the current snapshot build:

    compile(group: 'org.springframework.data', name: 'spring-data-redis', version: '1.4.0.BUILD-SNAPSHOT')