Spring Cloud Netflix:ribbon.NIWSServerListClassName 和 ribbon.listOfServers 有什么区别?
Spring Cloud Netflix: What is the difference between ribbon.NIWSServerListClassName and ribbon.listOfServers?
我正在使用 Ribbon 和 Eureka。
我的应用程序能够在以下两种配置中调用 other-service。我首先使用 NIWSServerListClassName
,然后使用 listOfServers
。
other-service:
ribbon:
eureka:
enabled: true
NIWSServerListClassName: com.netflix.niws.loadbalancer.DiscoveryEnabledNIWSServerList
ServerListRefreshInterval: 1000
.
other-service:
ribbon:
eureka:
enabled: true
listOfServers: com.netflix.niws.loadbalancer.DiscoveryEnabledNIWSServerList
ServerListRefreshInterval: 1000
我已经看到 NIWSServerListClassName
和 listOfServers
在 spring-cloud-netflix GitHub 问题中(在文档中的某些地方也有)用于获取功能区的服务器列表。
这两种功能区属性有什么区别?它们的目的相同吗?
下面的文档解释了 listOfServers 适用于 Ribbon,如果使用 Eureka 则会被覆盖。
6.5 Using Ribbon with Eureka
When Eureka is used in conjunction with Ribbon (that is, both are on
the classpath), the ribbonServerList is overridden with an extension
of DiscoveryEnabledNIWSServerList, which populates the list of servers
from Eureka.
他们继续说,当不使用 Eureka 时,您可以使用 listOfServers:
However, if you prefer not to use Eureka, Ribbon and Feign also
work..... You can supply the configuration as follows stores:
ribbon:
listOfServers: example.com,google.com
来自:
https://cloud.spring.io/spring-cloud-netflix/multi/multi_spring-cloud-ribbon.html
我正在使用 Ribbon 和 Eureka。
我的应用程序能够在以下两种配置中调用 other-service。我首先使用 NIWSServerListClassName
,然后使用 listOfServers
。
other-service:
ribbon:
eureka:
enabled: true
NIWSServerListClassName: com.netflix.niws.loadbalancer.DiscoveryEnabledNIWSServerList
ServerListRefreshInterval: 1000
.
other-service:
ribbon:
eureka:
enabled: true
listOfServers: com.netflix.niws.loadbalancer.DiscoveryEnabledNIWSServerList
ServerListRefreshInterval: 1000
我已经看到 NIWSServerListClassName
和 listOfServers
在 spring-cloud-netflix GitHub 问题中(在文档中的某些地方也有)用于获取功能区的服务器列表。
这两种功能区属性有什么区别?它们的目的相同吗?
下面的文档解释了 listOfServers 适用于 Ribbon,如果使用 Eureka 则会被覆盖。
6.5 Using Ribbon with Eureka
When Eureka is used in conjunction with Ribbon (that is, both are on the classpath), the ribbonServerList is overridden with an extension of DiscoveryEnabledNIWSServerList, which populates the list of servers from Eureka.
他们继续说,当不使用 Eureka 时,您可以使用 listOfServers:
However, if you prefer not to use Eureka, Ribbon and Feign also work..... You can supply the configuration as follows stores:
ribbon: listOfServers: example.com,google.com
来自: https://cloud.spring.io/spring-cloud-netflix/multi/multi_spring-cloud-ribbon.html