3

我已将 spring boot 更新为2.5.2from 2.1.8.RELEASE。在此之前,liveness 和 readiness 探测很好。现在更新 spring boot 后,我​​更新了我的应用程序属性文件:

management.endpoints.web.exposure.include=*
management.endpoints.jmx.exposure.include=health,info
management.endpoint.metrics.enabled=true
management.endpoint.prometheus.enabled=true
management.metrics.enable.*=true
management.metrics.enable.all=true
management.metrics.export.prometheus.enabled=true
management.metrics.use-global-registry=true




management.endpoint.health.probes.enabled=true
management.health.livenessstate.enabled=true
management.health.readinessstate.enabled=true
management.endpoint.health.show-details=always

我已分别为某些文档添加了最后 4 行。

在本地启动项目并从浏览器检查后:

http://localhost:8090/actuator/health/liveness{"status":"UP"}

http://localhost:8090/actuator/health/readiness给出{"status":"OUT_OF_SERVICE"}的是503状态。

{
    "status": "OUT_OF_SERVICE",
    "components": {
        "diskSpace": {
            "status": "UP",
            "details": {
                "total": 499963174912,
                "free": 326313852928,
                "threshold": 10485760,
                "exists": true
            }
        },
        "livenessState": {
            "status": "UP"
        },
        "ping": {
            "status": "UP"
        },
        "readinessState": {
            "status": "OUT_OF_SERVICE"
        }
    },
    "groups": [
        "liveness",
        "readiness"
    ]

}

在我的依赖项下的pom文件中:

<dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <version>${spring-boot.version}</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
            <version>${spring-boot.version}</version>
            <scope>runtime</scope>
        </dependency>
4

0 回答 0