Harshana
Harshana

Reputation: 7647

Redis sentinel set up with spring boot

I have redis on 1 master and 2 slaves and on each server a sentinel process is running on port 26379

I want to know how to configure a sentinel as master in order to add for below in application.property file.

spring.redis.sentinel.master=
spring.redis.sentinel.nodes=

I have redis server 2.8.19 and spring boot 1.3.4, spring-data-redis 1.6.4 jars

Upvotes: 5

Views: 20517

Answers (2)

Panagiotis Bougioukos
Panagiotis Bougioukos

Reputation: 18959

Recent Update

For future readers having the same problem and need to apply those configurations but having already upgraded to Spring Boot 3.0, then the configurations should be

spring.data.redis.sentinel.master= someMaster #name of master redis server
spring.data.redis.sentinel.nodes= some.domain.for.sentinel:26379, some.other.domain.for.other.sentinel:26379 #list of sentinels.

Upvotes: 1

Mickael
Mickael

Reputation: 4558

According to Add support for Redis Sentinel Configuration GitHub request,

Spring Data Redis 1.4.0 will introduce redis Sentinel support. Sentinels can be configured using RedisSentinelConfiguration. When applied to RedisConnectionFactory the sentinel configuration will be used to determine current master node an perform failover in case a new master is elected.

Added new config properties to RedisProperties:

spring.redis.sentinel.master=mymaster #name of redis server
spring.redis.sentinel.nodes=127.0.0.1:26379,127.0.0.1:26380 #deliminated list of sentinels.

I hope this can help you.

Upvotes: 10

Related Questions