简体   繁体   English

如何使用 Eureka 服务器将配置客户端连接到配置服务器?

[英]How to connect Config Client to Config server using Eureka server?

I have Scenario that whenever we use config server with config client we need to put in bootstrap.yaml.我有一个场景,每当我们将配置服务器配置客户端一起使用时,我们都需要放入 bootstrap.yaml。 suppose my config server on port 9001 so i need to hardcore this value in properties file that is http://localhost:9001:/假设我的配置服务器在端口9001 上,所以我需要在http://localhost:9001:/ 的属性文件中硬核这个值

My question is, "it is possible to connect config client to config server using eureka server so that we can remove hardcore properties"我的问题是,“可以使用eureka 服务器配置客户端连接到配置服务器,以便我们可以删除核心属性”

These are properties I used which solved my problem这些是我使用的解决我问题的属性

Eureka properties尤里卡属性

spring.application.name=discovery-server
eureka.client.registerWithEureka = true
eureka.client.fetchRegistry = false
server.port = 9050
eureka.client.serviceUrl.defaultZone=http://localhost:9050/eureka/

Config-server properties配置服务器属性

spring:
  application:
    name: configserver
  cloud:
    config:
      server:
        git:
          uri: git-url
          username: git-username
          password: git-password
      fail-fast: true
    
server:
  port: 8080
    
eureka:
   client:
      serviceUrl:
         defaultZone: http://localhost:9050/eureka

Config-client properties配置客户端属性

spring:
  application:
    name: x
  cloud:
    config:
      profile: dev
      fail-fast: true
      discovery:
        enabled: true
        service-id: CONFIGSERVER
      retry:
        initial-interval: 2000
        multiplier: 1.5
        max-interval: 60000
        max-attempts: 100
        
server:
  port: 8081

eureka:
   client:
      serviceUrl:
         defaultZone: http://localhost:9050/eureka
      fetch-registry: true
   instance:
    lease-renewal-interval-in-seconds: 10

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM