eureka ConnectException如何解决

发布时间:2024年01月11日

最近开始学习微服务,配置了一个超级简单的eureka,居然频繁报错无法启动,总是报ConnectException,踩了不少坑,因此记录一下。

  • 未解决】一种典型的做法是配置一个WebSecurityConfig,把某些安全策略关掉,未果。
  • 已解决】另一种做法是在application.yml配置里面禁止eureka client注册自己,将fetchRegistryregisterWithEureka设置为false。
# 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.

文章来源:https://blog.csdn.net/cliukai/article/details/135520210
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。