如何在spring actuator health中排除redis check

628mspwn  于 2021-06-09  发布在  Redis
关注(0)|答案(2)|浏览(876)

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状态不能影响服务状态吗?我还需要查看healthcheckapi中的redis细节。

iyfjxgzm

iyfjxgzm1#

management.health.redis.enabled=false 添加此代码以禁用应用程序中的redis健康检查。yaml/properties

tvmytwxo

tvmytwxo2#

我通常检查一下https://docs.spring.io/spring-boot/docs/current/reference/html/appendix-application-properties.html 这是为了找到你正在做的事情
在那里,我发现management.health.redis.enabled(默认为true),所以我的猜测是,如果您显式地将其设置为false,它将从您的healthcheck中消失

相关问题