将 Spring Cloud Zookeeper 与 Spring Cloud 组件一起使用
Feign、Spring Cloud Gateway 和 Spring Cloud LoadBalancer 都可以与 Spring Cloud Zookeeper 一起使用。
Spring Cloud LoadBalancer 与 Zookeeper
Spring Cloud Zookeeper 提供 Spring Cloud LoadBalancer 的 ServiceInstanceListSupplier
的实现。 当您使用 spring-cloud-starter-zookeeper-discovery
时,Spring Cloud LoadBalancer 默认配置为使用 ZookeeperServiceInstanceListSupplier
。
如果您之前在 Zookeeper 中使用了 StickyRule,则当前堆栈中的替代方案是 SC LoadBalancer 中的 SameInstancePreferenceServiceInstanceListSupplier 。 您可以在 Spring Cloud Commons 文档中阅读有关如何设置它的信息。 |