【问题标题】:How can i disable spring boot actuator elastic search health requests?如何禁用弹簧启动执行器弹性搜索健康请求?
【发布时间】:2020-04-09 02:00:08
【问题描述】:

我有一个 Spring Boot 应用程序,它使用本地弹性搜索和 Spring Boot Actuator 2.1.2 仅用于度量目的。现在我需要实现一个默认的健康检查,所以我在我的配置 application.properties 类中打开它,如下所示:

management.endpoints.web.exposure.include=...,health
management.endpoint.health.show-details=never

它工作正常,我可以使用默认实现调用http://localhost/actuator/health 来达到健康状态。

但有一个时刻我不喜欢。我发现每次当我得到像{"status":"UP"} 这样不详细的答案时,执行器都会在

处进行不必要的弹性搜索调用
ElasticsearchHealthIndicator.doHealthCheck(Health.Builder builder)

我打算摆脱无用的电话。

我能以某种方式只禁用这个调用吗?

【问题讨论】:

    标签: spring spring-boot actuator


    【解决方案1】:

    尝试在 application.properties 文件中使用以下属性

    management.health.elasticsearch.enabled=false
    

    【讨论】:

    • 我不能这样做,因为我在指标目的中使用了 HealthIndicator bean。将此属性设置为 false 会导致 bean 依赖错误。我希望有一种方法可以通过一些定制的健康服务来处理它......
    猜你喜欢
    • 2020-06-17
    • 1970-01-01
    • 2020-04-11
    • 2020-07-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-08-16
    相关资源
    最近更新 更多