Spring Cloud Config 配置中心高可用

详细参见

《Spring Cloud 与 Docker微服务架构实战》

p163-9.10 Spring Cloud Config 与 Eureka 配合使用

p163-9.12 ConfigServer 的高可用

1、关键是添加 eureka 注册中心功能

别忘了添加包

别忘了添加@注解,服务器添加EnableEurekaServer 客户端添加 @EnableDiscoveryClient

2、客户端变更一下原来连接 配置服务器的配置。

      discovery:
        enabled: true # 开启
        service-id: thunisoft-microservice-configs # 配置服务的 spring.application.name
spring:
  application:
    name: thunisoft-microservice-foo
  cloud:
    config:
      #uri: http://localhost:8979/
      profile: dev
      label: master
      discovery:
        enabled: true
        service-id: thunisoft-microservice-configs
  # rabbitMQ
  rabbitmq:
    host: localhost
    port: 5672
    username: guest
    password: guest
encrypt:
  key: rootroot
# eureka
eureka:
  client:
    service-url:
      defaultZone: http://localhost:12345/eureka

  

原文地址:https://www.cnblogs.com/hfultrastrong/p/8574513.html