eureka ConnectException如何解决

最近开始学习微服务,配置了一个超级简单的eureka,居然频繁报错无法启动,总是报ConnectException,踩了不少坑,因此记录一下。

  • 未解决】一种典型的做法是配置一个WebSecurityConfig,把某些安全策略关掉,未果。
  • 已解决 】另一种做法是在application.yml配置里面禁止eureka client注册自己,将fetchRegistryregisterWithEureka设置为false。
yml 复制代码
# application.yml
eureka:
  client:
    fetchRegistry: 'false'
    registerWithEureka: 'false'

Reference:
https://stackoverflow.com/questions/56114871/cannot-connect-to-eureka-server-exception-java-net-connectexception-connectio

Explanation:

We're telling the built-in Eureka Client not to register with itself because our application should be acting as a server.

The reason behind this error is Eureka client is trying to register and fetch information with Eureka server. This happens because of bean auto configuration feature in spring Boot. As you are deploying the Eureka server you don't need want to register with yourself. That's why we are disabling.

相关推荐
dessler2 天前
Docker-如何启动docker
运维·docker·云原生·容器·eureka
暴富的Tdy3 天前
【快速上手Docker 简单配置方法】
docker·容器·eureka
维李设论3 天前
Node.js的Web服务在Nacos中的实践
前端·spring cloud·微服务·eureka·nacos·node.js·express
筏镜4 天前
调整docker bridge地址冲突,通过bip调整 bridge地址
java·docker·eureka
岁月变迁呀4 天前
Eureka服务注册源码
spring cloud·eureka
阿髙4 天前
docker 软连接修改存储位置
java·docker·eureka
夏尔Gaesar5 天前
Failed to start Docker Application Container Engine
docker·容器·eureka
wyy72935 天前
树莓派4B 搭建openwrt内置超多插件docker,nas等等使用教程
docker·容器·eureka
勇-子5 天前
K8s docker-compose的入门
docker·eureka·kubernetes
黄白柴柴6 天前
docker nvidia container toolkit
java·docker·eureka