【发布时间】:2019-08-05 03:56:13
【问题描述】:
对于我一直在研究的微服务,我创建了一个自定义健康检查类,扩展了 AbstractHealthIndicator 并能够获取输出
http://localhost:8080/actuator/health
但是当我向 consul 注册服务时,健康检查状态是失败的。
尝试在引导程序中使用 consul 健康检查将执行器 url 配置为spring.cloud.consul.discovery.health-check-url= http://localhost:8080/actuator/health。但它仍然失败并出现错误Get http://localhost:8566/actuator/health: dial tcp 127.0.0.1:8566: connect: connection refused
如果我尝试使用health-check-path: /actuator/health,它根本不会走这条路,默认为http://QINDW062.it.local:8566/my-health-check。
有什么建议吗?
编辑:
【问题讨论】:
-
您的领事客户端是否与您的应用程序在同一台机器上运行?你能提供你的服务定义(consul.io/docs/agent/services.html#service-definition)吗?
-
consul 正在通过 docker 运行。在引导程序中配置了 ip,我的应用程序能够从中读取值。
标签: spring spring-boot microservices consul spring-boot-actuator