Description
I have deployed a Redis Cluster in my system with a configuration of 3 masters and 3 slaves, where all 6 nodes are on different machines.
And I have set up the following configuration, ensures that the system performs all read and write operations only through the master nodes, while the slave nodes are only used for data backup.
LettuceClientConfiguration.LettuceClientConfigurationBuilder lettuceClientConfigurationBuilder = LettuceClientConfiguration.builder(); lettuceClientConfigurationBuilder.readFrom(ReadFrom.MASTER);
And I have set up the following configuration of my RedisTemplate, which 'pingBeforeActivateConnection' is set to true.
ClusterClientOptions.Builder clusterClientOptionsBuilder = ClusterClientOptions.builder(); clusterClientOptionsBuilder.autoReconnect(true).pingBeforeActivateConnection(true);
I noticed that when using the redisTemplate.executePipelined command, it pings all Redis nodes. But why?
Other commands like opsForValue().get() and opsForList().rightPush() don’t ping all nodes.
This causes a problem when any machine is down because the ping is still executed, forcing my application to wait until the ping times out.