spring - 如何在 Spring 执行器健康状况中排除 redis 检查

标签 spring spring-boot redis spring-boot-actuator health-check

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/

相关文章:

spring-boot - Prometheus 端点是一个空白页 - 在 Spring Boot 应用程序中使用 kamon 和 Prometheus 报告器

java - Spring Cache 从值中获取键

java - 如何选择合适的spring、struts和hibernate版本,有什么区别?

java - Akka 和 spring 配置

java - Spring Boot Kotlin API 为所有端点返回 404 响应

nosql - 对于不适合内存的大型数据集,最好的缓存引擎是什么?

redis - Redis发布/订阅和Redis流有何相似之处?

node.js - 为什么node express req.session随着redis消失了?

spring - 使用 Grails Spring DSL 进行依赖注入(inject)

Spring-boot应用程序部署问题