springboot health检查
生活随笔
收集整理的這篇文章主要介紹了
springboot health检查
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
health檢查一般用于spring cloud注冊中心的存活檢查,比如spring cloud consul配置
spring:cloud:consul:discovery:register: trueinstance-id: ${spring.application.name}:${server.port}service-name: ${spring.application.name}port: ${server.port}healthCheckPath: /actuator/healthhealthCheckInterval: 15sconfig:discovery:enabled: trueservice-id: ${spring.application.name}:${server.port}fail-fast: true?
實現方式
pom引入
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
?
檢查頁面
/actuator/health
返回
{"status":"UP"}
?
如果返回為down,監聽
org.springframework.boot.actuate.health.HealthEndpoint
中的health()方法,找到down的連接。
總結
以上是生活随笔為你收集整理的springboot health检查的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: MySQL 表一列逗号分隔字段,按逗号切
- 下一篇: linux中tree命令