欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Eureka启动报错Cannot execute request on any known server

程序员文章站 2022-03-02 13:48:00
...

使用配置中心配置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/
相关标签: 异常解决方案