Skip to content

Connect to all nodes of a RedisCluster at startup #3197

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

You must be logged in to vote

Going to write a succinct answer here for others who have the same question about warming up all Redis Cluster connections.

As @tishun mentioned in the other answer,

By design the driver does not pre-warm cluster connections:

You could iterate over all connections of the cluster, as suggested by @mp911de in #1111 (comment) and - for instance - send a PING command to ensure connections are established.

In order to successfully do this, try the following code

RedisClusterClient lettuceClient = RedisClusterClient.create(resources, redisURI);
StatefulRedisClusterConnection<byte[], byte[]> lettuceClusterConnection = lettuceClusterClient.connect(ByteArrayCodec.INSTANCE);

// Warm up connectio…

Replies: 2 comments 6 replies

Comment options

You must be logged in to vote
6 replies
@RohanNagar
Comment options

@mp911de
Comment options

@RohanNagar
Comment options

@RohanNagar
Comment options

@RohanNagar
Comment options

Comment options

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