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.

相关推荐
ai产品老杨1 小时前
打破芯片壁垒:基于Docker与K8s的GB28181/RTSP异构AI视频平台架构实战
人工智能·docker·eureka·时序数据库·etcd
1candobetter13 天前
Docker Compose Build 与 Up 的区别:什么时候必须重建镜像
docker·容器·eureka
一次旅行14 天前
Docker安全总结
安全·docker·eureka
老葱头蒸鸡14 天前
(3)Docker搭建Network网络
云原生·eureka
weixin_3954489114 天前
cursor日志0224
eureka·flink·etcd
hopsky14 天前
Docker Compose 启动的容器内存 监控
docker·容器·eureka
海兰14 天前
Docker部署OpenClaw及常见问题解决(win11)
docker·容器·eureka
曹天骄15 天前
在 Docker 容器中控制宿主机 Docker:DoD 与 DinD 的技术原理解析
docker·容器·eureka
sunshinebo15 天前
一次 GitLab 无法启动的排查:Docker 日志把 500G 磁盘打满
docker·eureka·gitlab