네로개발일기

개발자 네로의 개발 일기, 자바를 좋아합니다 !

'2022/03/31'에 해당되는 글 1건


반응형

서버의 상태를 확인하려면 Health Check를 사용하면 된다.

implementation('org.springframework.boot:spring-boot-starter-actuator')

- Health Check 기능은 spring-boot-starter-actuator 라이브러리의 기능 중 하나이므로 사용하려면 actuator 라이브러리를 추가해야 한다.

- spring-boot-starter-actuator 라이브러리는 Spring Boot 버전과 동일한 버전을 사용해야 한다.

management:
  endpoints:
    web:
      base-path: /application
      path-mapping:
        health: healthcheck
  endpoint:
    health:
      show-details: always

base-path: actuator의 base path를 설정한다. (기본값은 /actuator)

path-mapping.health: health-check end point (기본값은 health)

show-details: health check API를 접근할 때 세부 정보를 확인한다. (never, when-authorized, always/ 기본값은 never)

 

# show-details: never로 설정
{"status": "UP"}

# show-details: always로 설정
{"status": "UP", 
 "details": {
   "diskSpace": {
     "status: "UP", 
     "details": {
       "total": 234685313024,
       "free": 158591512576,
       "threshold": 10485760
     }
   },
   "redis": { 
     "status":"UP",
     "details":{"version":"5.0.7"}
   },
   "db":{
     "status":"UP",
     "details":{
       "database":"MariaDB",
       "hello":1
     }
   }
 }
}
728x90
반응형
blog image

Written by ner.o

개발자 네로의 개발 일기, 자바를 좋아합니다 !