在工程中引入
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
依賴
這樣在啟動的時候就會對mysql和redis進行健康檢查】
2022-01-28 14:56:49.910 info 87856 nacos-provider --- [] [3)-10.100.10.92] o.s.b.a.health.RedisHealthIndicator : Health check failed org.springframework.data.redis.RedisConnectionFailureException: Cannot get Jedis connection; nested exception is redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool at org.springframework.data.redis.connection.jedis.JedisConnectionFactory.fetchJedisConnector(JedisConnectionFactory.java:204) at org.springframework.data.redis.connection.jedis.JedisConnectionFactory.getConnection(JedisConnectionFactory.java:348) at org.springframework.data.redis.core.RedisConnectionUtils.doGetConnection(RedisConnectionUtils.java:129)
如果鏈接不可用,就會報相應的鏈接錯誤