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



我有一个场景,每当我们在config客户端中使用config-server时,我们都需要放入bootstrap.yaml。假设我的配置服务器位于端口9001,所以我需要在的属性文件中硬核这个值http://localhost:9001:/

我的问题是;可以使用eureka服务器config客户端连接到config-server

这些是我用来解决问题的属性

尤里卡特性

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

配置服务器属性

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

配置客户端属性

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

最新更新