Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 354
Harshana Avatar asked Feb 07 '17 11:02

Harshana


People also ask

How do I configure Redis cache in spring boot?

1) Start Redis Server. 2) Start your Spring Boot Application. 3) Make a Rest Call using any REST client on operations which are get, update & delete. You can use any REST client such as any User Interface, RestTemplate or Postman etc.

How do I connect my Redis Sentinel?

Commands. Use “redis-cli” with port 26379 to connect to sentinel. Note: you always want to tail the /var/log/sentinel/sentinel. log on all sentinels to see the cluster interaction.

How do I run Redis in sentinel mode?

Launch Sentinel To restart the Redis service, run this command: sudo service redis restart . To start Redis in Sentinel mode, run redis-server /etc/redis/sentinel. conf –sentinel .


1 Answers

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.

like image 81
Mickael Avatar answered Sep 22 '22 21:09

Mickael