详细参见

《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

  

 

相关文章:

  • 2021-11-07
  • 2021-11-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-23
  • 2021-08-14
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-11-10
  • 2021-11-20
  • 2021-10-15
  • 2021-07-23
相关资源
相似解决方案