Spring Boot Actuator Health Returning DOWN
Solution 1:
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.
For a production environment you should enable security around the /health
endpoint.
Edit
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.
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})
Solution 2:
If the health url shows "DOWN" or HTTP 503 - Service Unavailable error, then try adding the below property in application.properties
URL - http://localhost:8080/actuator/health
management.endpoint.health.show-details=always
Now the url should show more than just DOWN. If Solr host is not reachable, then ignore the Solr check using the below exclusion -
@SpringBootApplication(exclude = { SolrAutoConfiguration.class })
Now the health should come up. The health check basically validates predefined health check internally (Example - DataSourceHealthIndicator, DiskSpaceHealthIndicator, CassandraHealthIndicator
, etc).
If one of the health indicator is down, the health will be down and you can see the error as a response after adding the property mentioned above to application.properties.
Solution 3:
in my case, I needed both these properties to get more details :
endpoints.health.sensitive: false
management.security.enabled: false
Otherwise, all I was getting was an DOWN status.
I had an issue with RabbitMQ connection : my application is not using it yet, but we've started wiring some code related to it. The application works fine, but we were getting DOWN health status, which was quite puzzling : Spring Boot is surprisingly silent in the logs, as no error shows at startup (I'll probably need to change my config to make it more verbose)
Solution 4:
I had the same issue with Springboot 2.1.0 where /actuator/health returned
{
status: "DOWN"
}
even though application was up.
Adding
management.health.defaults.enabled=false
to properties file fixed the issue.
Solution 5:
You guy are probably using Consul 1.0. There is a known issue in Spring Could Consul 1.1.0 or so with Consul 1.0. See this - https://github.com/spring-cloud/spring-cloud-consul/issues/365 and this - https://github.com/hashicorp/consul/issues/3635
You will have to upgrade to Spring Could Consul 1.3.0.RELEASE.