Answer the question
In order to leave comments, you need to log in
How to set up a connection to Redis on jelastic via Spring?
I added Redis to my environment and the following data came to my mail: username, password, IP, host, port and sentinel port.
I'm confused to connect through JedisConnectionFactory, but nothing comes out. What am I doing wrong?
@Bean
public JedisConnectionFactory connectionFactory() {
JedisShardInfo shardInfo = new JedisShardInfo(HOST, USERNAME);
shardInfo.setPassword(PASSWORD);
RedisSentinelConfiguration sentinelConfiguration = new RedisSentinelConfiguration()
.master("mymaster")
.sentinel(HOST, PORT);
JedisConnectionFactory jedisConnectionFactory = new JedisConnectionFactory(sentinelConfiguration);
jedisConnectionFactory.setShardInfo(shardInfo);
// jedisConnectionFactory.setHostName(HOST);
// jedisConnectionFactory.setPassword(PASSWORD);
return jedisConnectionFactory;
}
Answer the question
In order to leave comments, you need to log in
It turned out that the library did not support the installed version of Redis, as soon as I brought it into line, everything worked. Now I use the jedis library, it seemed to me the most convenient to use.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question