如何在弹簧执行器健康中排除Redis检查

问题描述 投票:0回答:1

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关闭时,实际上服务是可用的。

服务状态是否不受Redis状态影响?并且我还需要在运行状况检查api中查看redis详细信息。

spring spring-boot redis spring-boot-actuator health-check
1个回答
0
投票

我通常会选择https://docs.spring.io/spring-boot/docs/current/reference/html/appendix-application-properties.html以查找类似您正在做的事情

并且在那里找到了management.health.redis.enabled(默认为true)因此我的猜测是,如果您将其明确设置为false,它将从您的健康检查中消失]

© www.soinside.com 2019 - 2024. All rights reserved.