redis 宕机时服务健康检查 api 响应 503。
{
"status": "DOWN",
"details": {
"diskSpace": {
"status": "UP",
"details": {
"total": 250790436864,
"free": 95412813824,
"threshold": 10485760
}
},
"db": {
"status": "UP",
"details": {
"database": "PostgreSQL",
"hello": 1
}
},
"refreshScope": {
"status": "UP"
},
"redis": {
"status": "DOWN",
"details": {
"error": "org.springframework.data.redis.connection.PoolException: Could not get a resource from the pool; nested exception is io.lettuce.core.RedisConnectionException: Unable to connect to localhost:6379"
}
}
}
}
但是实际上redis宕机的时候service是可用的。
服务状态可以不受 redis 状态的影响吗?我还需要查看健康检查 api 中的 redis 详细信息。
最佳答案
management.health.redis.enabled=false
添加此代码以在 application.yaml/properties 中禁用 Redis 运行状况检查
关于spring - 如何在 Spring 执行器健康状况中排除 redis 检查,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61136073/