4. 使用 Spring Cloud Zookeeper 与 Spring Cloud 组件
Feign、Spring Cloud Gateway 和 Spring Cloud LoadBalancer 都与 Spring Cloud Zookeeper 一起工作。
4.1. 带有Zookeeper的Spring Cloud LoadBalancer
Spring Cloud Zookeeper 提供了 Spring Cloud LoadBalancer 的 ServiceInstanceListSupplier 实现。
当使用 spring-cloud-starter-zookeeper-discovery 时,Spring Cloud LoadBalancer 会默认使用 ZookeeperServiceInstanceListSupplier。
如果之前你在使用Zookeeper中的StickyRule,当前堆栈中的替换是SC LoadBalancer中的SameInstancePreferenceServiceInstanceListSupplier。你可以阅读如何在Spring Cloud Commons文档中进行设置。 |