Spring Boot整合redis sentinel和读写分离

9月 12, 2023 |

spring boot配置项

spring:
  redis:
   .sentinel:
     master: mymaster
     nodes: 192.168.140.128:5000,192.168.140.128:6000
     username: sentinel-user
     password: sentinel@123

Lettuce 读写分离

@Bean
public LettuceClientConfigurationBuilderCustomizer
			lettuceClientConfigurationBuilderCustomizer() {
	return p -> p.readFrom(ReadFrom.SLAVE_PREFERRED);
}

Posted in: redis

Comments are closed.