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.

相关推荐
JavaPub-rodert2 天前
为什么 ZooKeeper 选择 CP,而 Eureka 选择 AP?
分布式·zookeeper·eureka
伞伞悦读3 天前
Docker 安装 MinIO 完整教程(新手友好版)
docker·容器·eureka
欧阳天羲4 天前
全屋智能家居一体化方案‑配套资料文档合集
云原生·eureka·智能家居
艾伦_耶格宇5 天前
【DOCKER进阶】-3 cgroups
docker·容器·eureka
仍然.5 天前
SpringCloud---Eureka介绍
java·spring cloud·eureka
骇客野人9 天前
基于Nginx+Eureka+Apollo+Jenkins+SpringBoot Web系统分布式部署方案
nginx·eureka·jenkins
wsad053211 天前
CentOS Stream 10 Docker 容器无法访问外网:xt_addrtype 内核模块缺失解决方法
linux·网络·docker·云原生·eureka·centos
bosins11 天前
Ubuntu 24.04部署llama.cpp下载资源一直中断的解决方案
ubuntu·eureka·llama
Ghost Face...12 天前
龙芯Docker全流程:安装到离线迁移实战
java·docker·eureka
童槿顏丶13 天前
docker自动化部署脚本
docker·eureka·自动化