Spring Boot 执行器运行状况返回 DOWN [英] Spring Boot Actuator Health Returning DOWN

查看:23
本文介绍了Spring Boot 执行器运行状况返回 DOWN的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我从 Spring Boot 应用程序 (1.2.4.RELEASE) 访问 /health 端点时,它返回 DOWN 的状态:

When I access the /health endpoint from my Spring Boot application (1.2.4.RELEASE) it is returning a status of DOWN:

{
    status: "DOWN"
}

是否有任何已知会覆盖状态的入门项目或库?有没有其他原因(除了编写自定义的)为什么会返回 DOWN ?

Are there any starter projects or libraries that are known to overwrite the status? Is there any other reason (besides writing a custom one) why it would return DOWN?

推荐答案

在您的 Spring 属性中,设置 endpoints.health.sensitive = false./health 端点将返回各种健康指标的列表,您可以从那里进行调试.

In your Spring properties, set endpoints.health.sensitive = false. The /health endpoint will then return the list of various health indicators and you can debug from there.

对于生产环境,您应该在 /health 端点周围启用安全性.

For a production environment you should enable security around the /health endpoint.

编辑

正如 Vincent 在下面指出的那样,如果健康端点受到保护,您还需要 management.security.enabled = false,这似乎是较新版本的 Spring Boot 中的默认设置.

As Vincent pointed out below, you'll also need management.security.enabled = false if the health endpoint is secured, which seems to be the default in more recent versions of Spring Boot.

我在 Spring Boot 中看到的一个常见问题是它会自动配置 Solr,并且无需额外配置 /health 端点指示 Solr DOWN.解决此问题的一种简单方法是使用以下注释在 Application.java 中禁用 Solr 自动配置:<代码>@SpringBootApplication(exclude={SolrAutoConfiguration.class})

A common issue that I've seen with Spring Boot out of the box is that it auto-configures Solr, and without additional configuration the /health endpoint indicates that Solr is DOWN. An easy way to fix this is to disable the Solr auto configuration in your Application.java with this annotation: @SpringBootApplication(exclude={SolrAutoConfiguration.class})

这篇关于Spring Boot 执行器运行状况返回 DOWN的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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