【发布时间】:2018-01-10 06:37:47
【问题描述】:
我有 2 个绝地缓存:
- 本地主机:6379
- cache.servermachine.com:6380,password=abcdef
一个 redis 实例在本地托管,一个在受保护的机器上使用密码。我有一个 Spring Boot 配置类。
public class RedisCacheConfig {
@Bean
public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() {
return new PropertySourcesPlaceholderConfigurer();
}
@Bean
JedisConnectionFactory jedisConnectionFactory() {
return new JedisConnectionFactory();
}
@Bean
RedisTemplate<Object, Object> redisTemplate() {
RedisTemplate<Object, Object> redisTemplate = new RedisTemplate<>();
redisTemplate.setConnectionFactory(jedisConnectionFactory());
return redisTemplate;
}
@Bean
CacheManager cacheManager() {
return new RedisCacheManager(redisTemplate());
}
}
在我的application.yml 文件中,如何将spring.redis.cluster 选项修改为具有多个节点,其中一个具有密码?
我正在使用 Jedis 1.9.0。
【问题讨论】:
-
Jedis 没有 1.9.0 版本。也许是 2.9.0?
标签: spring-boot caching redis jedis spring-data-redis