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.

相关推荐
fen_fen12 小时前
Docker MongoDB 配置 0.0.0.0 监听(外部可访问)操作文档
mongodb·docker·eureka
BLUcoding12 小时前
Docker 离线安装和镜像源配置
java·docker·eureka
Warren982 天前
接口测试理论
docker·面试·职场和发展·eureka·ansible
江湖有缘4 天前
轻量级知识协作平台搭建:Docker + MediaWiki入门教程
docker·容器·eureka
七夜zippoe4 天前
Docker容器化Python应用最佳实践:从镜像优化到安全防护
python·docker·云原生·eureka·容器化
Knight_AL4 天前
Dockerfile 的 EXPOSE 和 Docker Compose 的 ports 有什么区别?
docker·容器·eureka
Cloud Traveler5 天前
Archcraft携手cpolar打造轻量化远程开发环境
网络·云原生·eureka
Riu_Peter6 天前
【记录】Ubuntu 安装 Docker
ubuntu·docker·eureka
Knight_AL6 天前
Docker 部署 Milvus 并连接现有 MinIO 对象存储
docker·eureka·milvus
摸鱼仙人~7 天前
OpenManus沙箱实现解析:从Docker容器到轻量替代方案
docker·容器·eureka