I have a redis cluster with master, slave and 3 sentinel servers. The master and slave is map to dns names as node1-redis-dev.com, node2-redis-dev.com. The redis server version is 2.8
I include below in my application.properties file.
spring.redis.cluster.nodes=node1-redis-dev.com:6379,node2-redis-dev.com:6379
spring.redis.pool.max-idle=8
spring.redis.pool.min-idle=0
spring.redis.pool.max-active=-1
spring.redis.pool.max-wait=-1
But when I inspect the StringRedisTemplate, I see localhost instead of cluster information under hostName property of JedisConnectionFactory.
Also I see the exception in creationStackTrace property of JedisPool.
java.lang.Exception
at org.apache.commons.pool2.impl.BaseGenericObjectPool.<init>(BaseGenericObjectPool.java:139)
at org.apache.commons.pool2.impl.GenericObjectPool.<init>(GenericObjectPool.java:107)
at redis.clients.util.Pool.initPool(Pool.java:43)
at redis.clients.util.Pool.<init>(Pool.java:31)
at redis.clients.jedis.JedisPool.<init>(JedisPool.java:80)
at redis.clients.jedis.JedisPool.<init>(JedisPool.java:74)
at redis.clients.jedis.JedisPool.<init>(JedisPool.java:55)
at org.springframework.data.redis.connection.jedis.JedisConnectionFactory.createRedisPool(JedisConnectionFactory.java:228)
at org.springframework.data.redis.connection.jedis.JedisConnectionFactory.createPool(JedisConnectionFactory.java:204)
The CasheRepository class looks like below,
@Component
@CacheConfig(cacheNames = "enroll", cacheManager = "enrollCM")
public class EnrollCashRepository {
@Autowired
private StringRedisTemplate stringRedisTemplate;
//Other methods
}
I am using spring boot 1.3.4 with spring-boot-starter-redis 1.2.7 which import jedis 2.7.3 dependency.
What am I missing with integrate redis cluster with Spring boot applicatiom?