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.

相关推荐
惜.己2 小时前
Docker启动失败 Failed to start Docker Application Container Engine.
spring cloud·docker·eureka
敲上瘾3 天前
Docker 容器核心指令与数据库容器化实践
linux·运维·服务器·docker·容器·eureka·dubbo
奋斗的老史3 天前
25年Docker镜像无法下载的四种对策
docker·容器·eureka
小马爱打代码3 天前
Spring Cloud Eureka 核心原理
spring cloud·eureka
小薛博客4 天前
12、Docker基本概念 容器与镜像与安装
docker·容器·eureka
雨中来客4 天前
解决Docker运行hello-world镜像报错问题
docker·eureka
逾非时6 天前
docker 网络配置
docker·云原生·eureka
待磨的钝刨6 天前
本地构建的 Docker 镜像迁移到另一台电脑上运行
docker·容器·eureka
追光天使7 天前
centos 7 安装docker、docker-compose教程
docker·eureka·centos
biubiubiu07068 天前
Docker常用命令大全
docker·容器·eureka