Spring Cloud 应用程序未向 Eureka 注册正确的端口 [英] Spring Cloud app doesn't register correct port to Eureka

查看:35
本文介绍了Spring Cloud 应用程序未向 Eureka 注册正确的端口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一组不错的 Spring Cloud 应用程序正在运行,但实际应用程序使用错误的端口注册到 DiscoveryServer.

I've got a nice set of Spring Cloud -applications running but the actual applications register with wrong port to the DiscoveryServer.

我有一个 Config-server、Eureka-server 和一个 Zuul-server,它们都可以很好地相互通信并且一切都很顺利.

I've got a Config-server, Eureka-server and a Zuul-server, which all talk to each other nicely and everything's shiny.

然后我添加了我的实际应用程序,一切都不再闪亮.我的应用程序在端口 9001 上运行并且可以工作,但不知何故它在端口 8080 上向 Eureka 注册.

Then I added my actual app and everything wasn't shiny no more. My app runs on port 9001 and it works, but somehow it registers with Eureka on port 8080.

我完全不知道发生了什么.

I'm totally baffled as to what is going on.

gradle 文件:https://gist.github.com/2ee0b2b9a8490e6f25c0

application.yml:https://gist.github.com/f0e811d01eae83020bad

application.yml: https://gist.github.com/f0e811d01eae83020bad

bootstrap.yml:https://gist.github.com/e947ac49a01ca1dfad0e

bootstrap.yml: https://gist.github.com/e947ac49a01ca1dfad0e

推荐答案

查看 如何使 Eureka 实例 ID 唯一.如果在同一台主机上运行多个服务器,则需要在eureka.intance.metadataMap中配置一个instanceId.此外,由于您使用 Eureka 来发现配置服务器,因此所有 eureka 配置都应该放在 bootstrap.yml 中,包括 server.port,以便正确的元数据由启动时的客户端.

See docs on how to make the Eureka instance ID unique. If you are running multiple servers on the same host, you need to configure an instanceId in the eureka.intance.metadataMap. Also, since you are using Eureka to discover the config server, all the eureka config should go in bootstrap.yml, including server.port so that the right metadata is sent by the client on startup.

这篇关于Spring Cloud 应用程序未向 Eureka 注册正确的端口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆