Spring Boot Actuator Health Returning DOWN

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.


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})


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)

Tags:

Spring Boot