使用配置中心配置eureka服务端的时候,启动服务以后一直报错Cannot execute request on any known server,网上查了一下原因:没有配置eureka.client.registerWithEureka=false和eureka.client.fetchRegistry=false
spring:
profiles:
active:
- dev
---
server:
port: 7001
spring:
profiles: dev
application:
name: mycloud-config-eureka-client
eureka:
instance:
hostname: eureka7001.com
client:
register-with-eureka: false
fetch-registry: false
service-url:
defaultZone: http://eureka7001.com:7001/eureka/
由于这段配置没有生效,client应该和instance对齐
client:
register-with-eureka: false
fetch-registry: false
改成
spring:
profiles:
active:
- dev
---
server:
port: 7001
spring:
profiles: dev
application:
name: mycloud-config-eureka-client
eureka:
instance:
hostname: eureka7001.com
client:
register-with-eureka: false
fetch-registry: false
service-url:
defaultZone: http://eureka7001.com:7001/eureka/