I'm using spring-boot-starter-data-redis-reactive and @SpringBootApplication annotation to auto configure redis connection. I have set up a redis cluster with 1 master and 2 slaves. I have the following config in the application.properties file
spring.redis.cluster.nodes=master-node:6379,slave1-node:6379,slave2-node:6379
I want to configure it so that all writes go to master, and all reads go to slaves (slave preferred).
I found that it is using Lettuce driver under the hood. In order to achieve this, I need to add .readFrom(SLAVE_PREFERRED)
into the LettuceClientConfiguration
. Looked at the org\springframework\boot\autoconfigure\data\redis\LettuceConnectionConfiguration.class
, I don't see a way to add this config. Any idea how to achieve this?