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.

相关推荐
骆驼10243 天前
40分钟的Docker实战攻略
云原生·eureka
qsqya4 天前
ceph/daemon安装部署
ceph·云原生·eureka
DogDaoDao5 天前
Docker全解析:从核心概念到2025年AI集成新特性
人工智能·docker·eureka·程序员
Lin_Aries_04215 天前
容器使用卷
linux·运维·docker·云原生·容器·eureka
一个帅气昵称啊5 天前
Docker命令大全:从基础到高级实战指南
docker·容器·eureka·架构·.net
Dontla9 天前
Dockerfile解析器指令(Parser Directive)指定语法版本,如:# syntax=docker/dockerfile:1
java·docker·eureka
Dxy12393102169 天前
Docker常用命令详解
docker·容器·eureka
wp90909 天前
Docker命令大全
docker·云原生·eureka
傻傻虎虎9 天前
【CentOS7】docker安装成功后测试,报Unable to find image ‘hello-world:latest‘ locally
docker·容器·eureka
惜.己10 天前
Docker启动失败 Failed to start Docker Application Container Engine.
spring cloud·docker·eureka