在 spring 配置客户端上配置多个服务器
configure multiple servers on spring configuration client
我有一个分布式系统,喜欢使用 spring 配置服务器。
寻址单个服务器实例完全没有问题。我喜欢做的是建立一个配置服务器集群,类似于 Eureka 服务器。
我现在遇到的问题是不知道怎么在客户端配置。
第一次尝试是:
spring.cloud.config.uri=http://server.A.com:8888,http://server.B.com:8888,http://server.C.com:8888
我收到的是 "invalid URL" 异常。
Spring Cloud Config 可以简单地使用发现机制来检测配置服务器并使用它来获取配置。此行为默认关闭。
要启用,请在 bootstrap.yml
文件中添加 spring.cloud.config.discovery.enabled=true
,并将配置服务配置和尤里卡配置放在那里。
有关详细信息,请阅读 Spring 云配置参考指南中的 Discovery first bootstrap 部分。
Spring Cloud Finchley 版本支持在 Configuration First bootstrap 设置中为配置服务器指定多个 URL。
To ensure high availability when you have multiple instances of Config Server deployed and expect one or more instances to be unavailable from time to time, you can either specify multiple URLs (as a comma-separated list under the spring.cloud.config.uri property)
我有一个分布式系统,喜欢使用 spring 配置服务器。
寻址单个服务器实例完全没有问题。我喜欢做的是建立一个配置服务器集群,类似于 Eureka 服务器。
我现在遇到的问题是不知道怎么在客户端配置。
第一次尝试是:
spring.cloud.config.uri=http://server.A.com:8888,http://server.B.com:8888,http://server.C.com:8888
我收到的是 "invalid URL" 异常。
Spring Cloud Config 可以简单地使用发现机制来检测配置服务器并使用它来获取配置。此行为默认关闭。
要启用,请在 bootstrap.yml
文件中添加 spring.cloud.config.discovery.enabled=true
,并将配置服务配置和尤里卡配置放在那里。
有关详细信息,请阅读 Spring 云配置参考指南中的 Discovery first bootstrap 部分。
Spring Cloud Finchley 版本支持在 Configuration First bootstrap 设置中为配置服务器指定多个 URL。
To ensure high availability when you have multiple instances of Config Server deployed and expect one or more instances to be unavailable from time to time, you can either specify multiple URLs (as a comma-separated list under the spring.cloud.config.uri property)