我可以使用绝地连接到redis示例,但不能使用redisson。
这是我的绝地配置:
@Bean
public JedisConnectionFactory jedisConnectionFactory(@Qualifier("appRedis") final RedisProperties redisProperties){
RedisStandaloneConfiguration config = new RedisStandaloneConfiguration(redisProperties.getHost(), redisProperties.getPort());
config.setPassword(RedisPassword.of(EncodeDecodeUtil.decode(redisProperties.getPassword())));
JedisClientConfiguration.JedisClientConfigurationBuilder jedisClientConfiguration = JedisClientConfiguration.builder();
jedisClientConfiguration.usePooling();
jedisClientConfiguration.readTimeout(redisProperties.getTimeout());
JedisConnectionFactory jedisConnectionFactory = new JedisConnectionFactory(config, jedisClientConfiguration.build());
jedisConnectionFactory.getPoolConfig().setMaxIdle(redisProperties.getJedis().getPool().getMaxIdle());
jedisConnectionFactory.getPoolConfig().setMinIdle(redisProperties.getJedis().getPool().getMinIdle());
jedisConnectionFactory.getPoolConfig().setMaxTotal(redisProperties.getJedis().getPool().getMaxActive());
return jedisConnectionFactory;
}
@Bean(name = "appRedis")
public RedisTemplate<String, List<Object>> redisTemplate(RedisConnectionFactory jedisConnectionFactory) {
RedisTemplate<String, List<Object>> template = new RedisTemplate<>();
template.setConnectionFactory(jedisConnectionFactory);
return template;
}
Yml:
spring:
data:
redis:
host: redishost.hosting.company.net
password: mypassword
port: 10790
jedis:
pool:
max-active: 5
max-idle: 5
max-wait: -1ms
min-idle: 3
connect-timeout: 30000
timeout: 5000
Redison配置:
@Bean
public RedissonClient client(){
Config config = new Config();
config.useSingleServer().
setAddress("redis://redishost.hosting.company.net:10790")
.setPassword("mypassword");
RedissonClient client = Redisson.create(config);
return client;
}
我得到一个错误:
WRONGPASS invalid username-password pair
我正在尝试使用redison的基本配置来进行试错。我只是设置一些基本的配置参数,比如地址、密码和端口
暂无答案!
目前还没有任何答案,快来回答吧!