Description
Hello,
I have previously asked this question directly to the Jedis-team redis/jedis#2567 but I don't really understand what is happening here. There are a few questions that I need to get adressed.
1. Is it supposed to be possible to use Redis sentinels and a specific Redis database (db > 0)?
While trying to connect to Redis using Sentinel and having the database property set to any number greater than 0, the applicaiton crashes. (Spring Boot 2.5.1, Spring Data Redis 2.5.1, Jedis 3.6.0) It seems like the new Jedis(hap.getHost(), hap.getPort(), sentinelConnectionTimeout, sentinelSoTimeout)
line inside JedisSentinelPool.java
in Jedis 3.6.0 crashes because we are trying to set the database number in redis sentinel rather than in the redis master node. See more in the jedis bug posted above.
Example configuration:
@Bean
fun jedisConnectionFactory(): RedisConnectionFactory? {
val sentinelConfig = RedisSentinelConfiguration()
.master("<your sentinel master>")
.sentinel("<your sentinel server>", 26379)
// This is the config creating the error, comment this in/out to test
sentinelConfig.database = 2
return JedisConnectionFactory(sentinelConfig)
}
2. If we are supposed to use Redis sentinels and a specific database (db > 0), then how do I configure that?
Since configuring the sentinelConfig with a database number breaks the application, where and when should I do it?
Thank you so much in advance.
Demo app is attached below that show the problem.
demo-app.zip