Files
spring-data-examples/redis/sentinel
Mark Paluch 5760555c57 #299 - Migrate Redis examples to Lettuce.
We now use Lettuce API instead of Jedis to align with Boot's driver choice.
2017-10-10 16:34:37 +02:00
..

Spring Data Redis - Sentinel Examples

This project contains samples of Sentinel specific features of Spring Data Redis.

Support for Sentinel

@Configuration
public class RedisSentinelApplicationConfig {

	static final RedisSentinelConfiguration SENTINEL_CONFIG = new RedisSentinelConfiguration().master("mymaster") //
			.sentinel("localhost", 26379) //
			.sentinel("localhost", 26380) //
			.sentinel("localhost", 26381);

	@Bean
	public RedisConnectionFactory connectionFactory() {
		return new LettuceConnectionFactory(sentinelConfig(), LettuceClientConfiguration.defaultConfiguration());
	}

	@Bean
	public RedisSentinelConfiguration sentinelConfig() {
		return SENTINEL_CONFIG;
	}

}