Skip to content

How to connect to redis cluster in asynchronous mode using lettuce connection factory. #2123

Answered by Pramit2512
Pramit2512 asked this question in Q&A
Discussion options

You must be logged in to vote

Well finally using lettuce library i am able to create a asynchronous connection which both sentinel and data nodes as password protected:

   @Bean
    public StatefulRedisMasterReplicaConnection statefulRedisMasterReplicaConnection() {


        RedisClient redisClient = RedisClient.create();

        LOG.info("created the redis client");

        RedisURI source = RedisURI.Builder
                .sentinel(getSentinelHost_1(), getSentinelPort_1())
                .withSentinel(getSentinelHost_2(), getSentinelPort_2())
                .withSentinel(getSentinelHost_3(), getSentinelPort_3())
                .withSentinelMasterId(getMasterName()).withPassword(getMasterPassword())
          …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Pramit2512
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant