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.

相关推荐
i小杨1 天前
Docker 相关使用收录
docker·容器·eureka
shixian10304112 天前
Dify Docker Compose 安装指南
docker·容器·eureka
曦樂~2 天前
【Docker】Compose
docker·容器·eureka
sg_knight3 天前
Docker 实战:如何限制容器的内存使用大小
java·spring boot·spring·spring cloud·docker·容器·eureka
java_logo3 天前
Docker 容器化部署 QINGLONG 面板指南
java·运维·docker·容器·eureka·centos·rabbitmq
掘根3 天前
【Docker】docker compose
docker·容器·eureka
java_logo3 天前
PERL Docker 容器化部署指南
linux·运维·docker·容器·eureka·centos·perl
java_logo5 天前
SGLANG Docker容器化部署指南
linux·运维·docker·容器·eureka·1024程序员节
斯普信专业组5 天前
Docker 常用命令与时区配置指南
docker·容器·eureka