我一直在使用下面的代码连接到redis集群(没有ssl)。有没有一种方法,我可以调整这一点,并能够调用aws弹性redis与ssl加密和redis认证启用?
@Bean
public RedisConnectionFactory redisConnectionFactory(
RedisClusterConfiguration redisClusterConfig, RedisProperties redisProperties){
JedisClientConfiguration jedisClientConfiguration =
JedisClientConfiguration.builder()
.useSsl()
.and()
.usePooling()
.and()
.connectTimeout(Duration.ofSeconds(redisProperties.getClusterTimeout()))
.build();
JedisConnectionFactory jedisConnectionFactory =
new JedisConnectionFactory(redisClusterConfig, jedisClientConfiguration);
jedisConnectionFactory.afterPropertiesSet();
return jedisConnectionFactory;
}
@Bean
public RedisTemplate<String, Object> redisTemplate(
RedisConnectionFactory redisConnectionFactory) {
RedisTemplate<String, Object> redisTemplate = new RedisTemplate<>();
redisTemplate.setConnectionFactory(redisConnectionFactory);
redisTemplate.afterPropertiesSet();
return redisTemplate;
}
我试过很多转机,但还是没能搞清楚。任何建议都非常感谢,因为我无法验证jedis是否支持ssl身份验证。如果是,那怎么办?
暂无答案!
目前还没有任何答案,快来回答吧!