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.

相关推荐
weixin_3954489117 小时前
动态分辨率的ioufsd
eureka·flink·etcd
前端小臻19 小时前
Eureka笔记(黑马)
微服务·eureka
爱宇阳1 天前
使用 Docker 容器备份与 Docker Compose 升级 GitLab 实例教程
docker·eureka·gitlab
眠りたいです2 天前
Docker:Docker image常用命令使用及实操
运维·docker·容器·eureka·镜像
悲喜自渡7213 天前
Docker指令自存
java·docker·eureka
weixin_462446234 天前
【实战原创】Docker 清理指南:以 Coze Studio 为例的资源保留与清理实践(非万能方案)
docker·容器·eureka
bloglin999994 天前
启动容器报错ls: cannot access ‘/docker-entrypoint-initdb.d/‘: Operation not permitted
docker·容器·eureka
学习3人组5 天前
CentOS9安装Docker
docker·容器·eureka
HillVue5 天前
中国未来 AI 路径的百度样本
大数据·eureka·dubbo
檀越剑指大厂6 天前
查看 Docker 镜像详情的几种常用方法
docker·容器·eureka