如何在不同主机上向 eureka-server 注册 eureka-clients。弹簧启动

2024-02-08

我正在本地主机上运行我的尤里卡服务器。我能够在本地主机上注册所有其他正在运行的服务,并且一切都按预期进行。

现在我想注册一个在Linux机器上运行的服务。我的属性看起来像这样:

spring.application.name=myService-service
spring.cloud.config.uri=http://myMachine.domain.lan:8888
server.port=8002
eureka.client.service-url.default-zone=http://myMachine.domain.lan:8761/eureka/

但该服务无法在本地主机上的尤里卡服务器上注册。 (最后它与在本地主机上运行的服务相同)

我得到这些例外:

java.net.ConnectException: Connection refused
com.netflix.discovery.shared.transport.TransportException: Cannot execute request on any known server

但我可以从本地主机上运行的配置服务获取配置文件。

我需要哪些配置才能将我的服务从 linux 机器(客户端)注册到 localhost(服务器)?

我使用这个注释:

Service:

@SpringBootApplication
@EnableDiscoveryClient
@EnableEurekaClient
public class MyServiceApplication {

尤里卡服务器:

@SpringBootApplication
@EnableEurekaServer
public class EurekaServiceApplication {

P.S.:相反的方法也是行不通的。意味着在 linux 机器上有 eureka 服务器,在 localhost 上有服务。获得相同的异常。

Edit1:

Eureka-服务器属性:

spring.application.name=eureka-service
spring.cloud.config.uri=http://myMachine.domain.lan:8888
server.port=8761
eureka.client.register-with-eureka=false
eureka.client.fetch-registry=false
eureka.instance.hostname=KBHWS242.myDomain.lan
eureka.instance.prefer-ip-address=true

Edit2:

testrv 是 Linux 机器。 (172.25.82.108)

2016-08-31 09:17:01.912  INFO 27105 --- [           main] com.netflix.discovery.DiscoveryClient    : Starting heartbeat executor: renew interval is: 30
2016-08-31 09:17:01.919  INFO 27105 --- [           main] c.n.discovery.InstanceInfoReplicator     : InstanceInfoReplicator onDemand update allowed rate per min is 4
2016-08-31 09:17:01.923  INFO 27105 --- [           main] com.netflix.discovery.DiscoveryClient    : Discovery Client initialized at timestamp 1472627821923 with initial instances count: 0
2016-08-31 09:17:02.068  INFO 27105 --- [           main] c.n.e.EurekaDiscoveryClientConfiguration : Registering application reservation-service with eureka with status UP
2016-08-31 09:17:02.070  INFO 27105 --- [           main] com.netflix.discovery.DiscoveryClient    : Saw local status change event StatusChangeEvent [timestamp=1472627822070, current=UP, previous=STARTING]
2016-08-31 09:17:02.073  INFO 27105 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient    : DiscoveryClient_RESERVATION-SERVICE/testsrv1.myDomain.lan:reservation-service:8002: registering service...
2016-08-31 09:17:02.173 ERROR 27105 --- [nfoReplicator-0] c.n.d.s.t.d.RedirectingEurekaHttpClient  : Request execution error

com.sun.jersey.api.client.ClientHandlerException: java.net.ConnectException: Connection refused

Caused by: java.net.ConnectException: Connection refused


2016-08-31 09:17:02.174  WARN 27105 --- [nfoReplicator-0] c.n.d.s.t.d.RetryableEurekaHttpClient    : Request execution failure
2016-08-31 09:17:02.175  WARN 27105 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient    : DiscoveryClient_RESERVATION-SERVICE/testsrv1.myDomain.lan:reservation-service:8002 - registration failed Cannot execute request on any known server

com.netflix.discovery.shared.transport.TransportException: Cannot execute request on any known server


2016-08-31 09:17:02.175  WARN 27105 --- [nfoReplicator-0] c.n.discovery.InstanceInfoReplicator     : There was a problem with the instance info replicator

com.netflix.discovery.shared.transport.TransportException: Cannot execute request on any known server

2016-08-31 09:17:02.594  INFO 27105 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8002 (http)
2016-08-31 09:17:02.596  INFO 27105 --- [           main] c.n.e.EurekaDiscoveryClientConfiguration : Updating port to 8002
2016-08-31 09:17:04.134  INFO 27105 --- [           main] o.h.h.i.QueryTranslatorFactoryInitiator  : HHH000397: Using ASTQueryTranslatorFactory
2016-08-31 09:17:04.659  INFO 27105 --- [           main] a.e.ReservationServiceApplication        : Started ReservationServiceApplication in 44.893 seconds (JVM running for 47.272)
2016-08-31 09:17:31.913  INFO 27105 --- [freshExecutor-0] com.netflix.discovery.DiscoveryClient    : Disable delta property : false
2016-08-31 09:17:31.914  INFO 27105 --- [freshExecutor-0] com.netflix.discovery.DiscoveryClient    : Single vip registry refresh property : null
2016-08-31 09:17:31.914  INFO 27105 --- [freshExecutor-0] com.netflix.discovery.DiscoveryClient    : Force full registry fetch : false
2016-08-31 09:17:31.914  INFO 27105 --- [freshExecutor-0] com.netflix.discovery.DiscoveryClient    : Application is null : false
2016-08-31 09:17:31.914  INFO 27105 --- [freshExecutor-0] com.netflix.discovery.DiscoveryClient    : Registered Applications size is zero : true
2016-08-31 09:17:31.914  INFO 27105 --- [freshExecutor-0] com.netflix.discovery.DiscoveryClient    : Application version is -1: true
2016-08-31 09:17:31.914  INFO 27105 --- [freshExecutor-0] com.netflix.discovery.DiscoveryClient    : Getting all instance registry info from the eureka server
2016-08-31 09:17:31.917 ERROR 27105 --- [freshExecutor-0] c.n.d.s.t.d.RedirectingEurekaHttpClient  : Request execution error

com.sun.jersey.api.client.ClientHandlerException: java.net.ConnectException: Connection refused

Caused by: java.net.ConnectException: Connection refused

2016-08-31 09:17:31.917  WARN 27105 --- [freshExecutor-0] c.n.d.s.t.d.RetryableEurekaHttpClient    : Request execution failure
2016-08-31 09:17:31.918 ERROR 27105 --- [freshExecutor-0] com.netflix.discovery.DiscoveryClient    : DiscoveryClient_RESERVATION-SERVICE/testsrv1.myDomain.lan:reservation-service:8002 - was unable to refresh its cache! status = Cannot execute request on any known server

com.netflix.discovery.shared.transport.TransportException: Cannot execute request on any known server

2016-08-31 09:17:31.924 ERROR 27105 --- [tbeatExecutor-0] c.n.d.s.t.d.RedirectingEurekaHttpClient  : Request execution error

com.sun.jersey.api.client.ClientHandlerException: java.net.ConnectException: Connection refused

Caused by: java.net.ConnectException: Connection refused

DiscoveryClient_RESERVATION-SERVICE/testsrv1.myDomain.lan:reservation-service:8002 - was unable to send heartbeat!

Edit3:

依赖项:

Maven: org.springframework.cloud:spring-cloud-commons:1.1.1.RELEASE
Maven: org.springframework.cloud:spring-cloud-config-client:1.1.2.RELEASE
Maven: org.springframework.cloud:spring-cloud-context:1.1.1.RELEASE
Maven: org.springframework.cloud:spring-cloud-netflix-core:1.1.5.RELEASE
Maven: org.springframework.cloud:spring-cloud-netflix-eureka-client:1.1.5.RELEASE
Maven: org.springframework.cloud:spring-cloud-starter:1.1.1.RELEASE
Maven: org.springframework.cloud:spring-cloud-starter-archaius:1.1.5.RELEASE
Maven: org.springframework.cloud:spring-cloud-starter-config:1.1.3.RELEASE
Maven: org.springframework.cloud:spring-cloud-starter-eureka:1.1.5.RELEASE
Maven: org.springframework.cloud:spring-cloud-starter-ribbon:1.1.5.RELEASE


Maven: org.springframework.cloud:spring-cloud-netflix-eureka-server:1.1.5.RELEASE

改变后.properties to .yml我的一项服务的文件并更正了拼写错误defaultZone一切都按预期进行。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何在不同主机上向 eureka-server 注册 eureka-clients。弹簧启动 的相关文章

随机推荐

  • Rouge gem 最小示例不显示格式?

    我部分遵循了简单的说明A of this https stackoverflow com a 37721539 5783745回答 该代码可以在浏览器中看到 但其格式不符合预期 当我查看源代码时 我可以看到正在生成 css 类 但它似乎没有
  • Python html 解析确实有效

    我正在尝试用Python 解析一些html 以前有一些方法确实有效 但现在 如果没有解决方法 我实际上无法使用任何方法 SGMLParser 消失后 beautifulsoup 出现问题 html5lib 无法解析 外面 的一半内容 lxm
  • 使用 EncryptedSharedPreferences 获取 KeyStoreException 和 GeneralSecurityException,我该如何解决这些问题?

    背景 在我开发的一个应用程序中 我将重要的内容 令牌 存储到 EncryptedSharedPreferences 中 取自here https developer android com jetpack androidx releases
  • 最长的链对

    你被给予n数字对 在每一对中 第一个数字总是小于第二个数字 一双 c d 可以按照 a b 当且仅当b小于c 可以以这种方式形成成对的链 找到形成的最长链对 我在接受亚马逊采访时遇到了这个问题 但无法找出答案 只是它与信息系统问题 http
  • 异步执行 CUDA 内存副本和 cuFFT

    我有一个 CUDA 程序 用于计算 FFT 比如说大小50000 目前 我将整个数组复制到 GPU 并执行 cuFFT 现在 我正在尝试优化程序 NVIDIA Visual Profiler 告诉我通过并行计算的并发来隐藏内存副本 我的问题
  • 如何解决“方法‘’没有重载需要 0 个参数”?

    我该如何修复这个错误 方法 输出 没有重载需要 0 个参数 错误位于 fresh output 的最底部 我不知道我做错了什么 有人可以告诉我应该做什么来修复代码吗 这是我的代码 using System using System Coll
  • 在 R 中高效计算 3d 数组的行和

    考虑数组a gt a lt array c 1 9 1 9 c 3 3 2 gt a 1 1 2 3 1 1 4 7 2 2 5 8 3 3 6 9 2 1 2 3 1 1 4 7 2 2 5 8 3 3 6 9 我们如何有效地计算由第三维
  • JS 传单:如何将 (Geo-)json ID 传递给单击事件?

    我的 django Web 应用程序应该执行以下操作 将 Geojson 对象传递到视图 使用传单映射点 并在用户单击点标记时显示一些附加信息 我对 js 不太熟悉 所以我陷入了将正确类型的数据绑定到click事件 这是一个示例 geojs
  • PHP 与 Pylons 的基准测试

    我想对 PHP 与 Pylons 进行基准测试 我希望两者的比较尽可能均匀 所以这就是我的想法 PHP 5 1 6 with APC 使用 smarty 模板连接到 MySQL 数据库 Python 2 6 1 使用带有 mako 模板的
  • 有没有办法在 GHCI 中查看模块中的函数列表?

    我发现在 Python 或 Common Lisp 中 您可以在运行时列出库的内容 这很方便 Haskell 是否有同样的东西 特别是在 GHCI 提示符下 GHCi 有一个 browse列出模块内容的命令 Prelude gt brows
  • 如何使用 %edit magic 打印我定义的对象的源代码

    Ipython 0 13 1 可以从 python 库打印对象的源 例如 os path abspath 但我无法打印我在 ipython 中通过 ed magic 定义的任何对象的源代码 我做错了什么吗 例如 我通过 ed 魔法定义一个类
  • 如何使用 UI 自动化(和/或 White)从外部应用程序获取控件的 DataContext

    我在用着White http white codeplex com 驱动 WPF 应用程序的 UI 到目前为止效果良好 然而 我现在需要深入研究被测应用程序的内部状态以检查某些条件 具体来说 我有一个 DataGrid 来自WPF工具包 h
  • TypeScript - 模块在运行时未定义

    我不明白我做错了什么 我在 VS2012 中创建了一个 TypeScript 项目 并在名为 Physics 的子目录中创建了一个名为 Vector ts 的文件 Module module Physics Class export cla
  • 如何在 SQL 表中查询数字 1 - 69 的所有可能的 5 个数字组合的逻辑有问题

    编辑 只是为了澄清一下 结果的顺序仅重要于 1 2 3 4 5 和 5 4 3 2 1 应该是相同的记录 所以我正在寻找不同的组合 我希望建立一个 SQL 数据库 其中包含数字 1 69 的所有可能的 5 个数字组合 其中相同的数字不能在单
  • 如何在android中对VideoView进行放大/缩小?

    我正在使用 VideoView 并从资源中运行视频 我想知道 有什么方法可以对正在运行的视频执行放大 缩小功能吗 好的 我遇到了这个问题 并通过删除 VideoView 并将其替换为纹理视图 http developer android c
  • 有没有 javascript LaTeX 方程渲染器? [关闭]

    Closed 这个问题正在寻求书籍 工具 软件库等的推荐 不满足堆栈溢出指南 help closed questions 目前不接受答案 我正在寻找一个纯粹的客户端 JavaScript 库 它将乳胶方程呈现为 HTML CSS 我讨厌我看
  • 如何实现检测一个视图被拖动到另一个视图上?

    我想要一个可拖动视图 同时能够不断监视到 目标 视图的距离 并检测何时将可拖动视图拖动到目标视图上 我的想法是得到Rect s两种视图并使用intersect 检查它们是否接触 然而 我的实现工作并不顺利 有时它会检测到错误位置的重叠或未检
  • 将目录添加到 PyCharm 中的 Python 路径?

    我希望能够使用paraview simplePyCharm 中的库 我的电脑中已经安装了 paraview 该软件包无法安装pip据我所知 没有 whl 文件 网站docs https www paraview org ParaView D
  • PHP:使用 php 裁剪时出现黑色图像

    我设置了一个上传 jpeg 的脚本 然后将其裁剪为缩略图 但有些用户遇到黑色图像 老实说我不知道 他们上传的是什么 也许是压缩格式与 php 库不兼容的 jpeg 这是我的简单代码 当我尝试使用我的照片时一切正常 所以我无法理解为什么有些用
  • 如何在不同主机上向 eureka-server 注册 eureka-clients。弹簧启动

    我正在本地主机上运行我的尤里卡服务器 我能够在本地主机上注册所有其他正在运行的服务 并且一切都按预期进行 现在我想注册一个在Linux机器上运行的服务 我的属性看起来像这样 spring application name myService