【问题标题】:Implementing Actuator with spring boot microservice architecture使用 Spring Boot 微服务架构实现 Actuator
【发布时间】:2020-05-18 11:30:57
【问题描述】:

我正在为我的项目使用 Spring Boot 和微服务架构。我想检查我的应用程序的运行状况。

我在 eureka-server 注册了 3 个服务。

我可以检查 eureka-server 的健康状况,但如何了解其他服务的健康状况?

http://localhost:8080/actuator/health

这工作但http://localhost:8080/api/user-service/actuator/health 不工作

请帮助解决方法。

谢谢!

【问题讨论】:

标签: java spring-boot microservices netflix-eureka spring-boot-actuator


【解决方案1】:

如果你真的想使用这个 url http://localhost:8080/api/user-service/actuator/health 进行健康检查,那么你必须为执行器设置一个上下文路径。

您可以使用以下属性,

management.context-path = /user-service

但这不是真的推荐,因为您仍在使用 LoadBalancer(我假设您的情况是 zuul)。 假设您有 3 个应用程序实例正在运行,但突然有一个实例停机,而您仍在使用负载均衡器进行运行状况检查,它不会说一个实例已停机,直到所有实例都停机。

所以在你的情况下,你可以使用 尤里卡服务器使用的健康检查网址。(如果你去尤里卡的控制台,你可以从那里得到它)。

或使用监控工具(这是标准方法)

【讨论】:

    猜你喜欢
    • 2020-03-11
    • 2019-07-15
    • 2018-03-28
    • 2019-02-01
    • 1970-01-01
    • 1970-01-01
    • 2017-12-26
    • 2020-05-27
    • 2019-09-06
    相关资源
    最近更新 更多