Spring Redis Cluster Settings

RedisClusterConfig

@Configuration
public class RedisClusterConfig {

       @Bean
    public RedisConnectionFactory connectionFactory() {

        List<String> clusterNodes = new ArrayList<String>();
        clusterNodes.add("192.168.56.101:6379");
        clusterNodes.add("192.168.56.102:6379");

        return new JedisConnectionFactory(new RedisClusterConfiguration(clusterNodes));
    }

    @Bean
    public RedisTemplate<String, String> redisTemplate(RedisConnectionFactory connectionFactory) {
        return new StringRedisTemplate(connectionFactory);
    }
}

results matching ""

    No results matching ""