문서의 선택한 두 판 사이의 차이를 보여줍니다.
양쪽 이전 판 이전 판 다음 판 | 이전 판 | ||
springframework:springboot:actuator [2018/03/28 16:30] kwon37xi |
springframework:springboot:actuator [2022/10/27 12:38] (현재) kwon37xi |
||
---|---|---|---|
줄 1: | 줄 1: | ||
====== Spring Boot Actuator ====== | ====== Spring Boot Actuator ====== | ||
* [[springframework: | * [[springframework: | ||
+ | * **actuator** 정보를 외부에 노출해서는 절대로 안된다.** 운영 웹서버에서는 방화벽으로 막거나, HTTP가 아닌 다른 방식으로 노출 방식을 바꾸고, 외부에는 HTTP/HTTPS 포트만 노출시켜야 한다. | ||
* [[http:// | * [[http:// | ||
* [[http:// | * [[http:// | ||
- | ===== 모든 Actuator 켜기 ===== | + | ===== 모든 Actuator 켜기 / 끄기 ===== |
* 기본적으로 info, health 정도만 켜져 있음. | * 기본적으로 info, health 정도만 켜져 있음. | ||
< | < | ||
management.security.enabled=false # 전체 다 활성화 | management.security.enabled=false # 전체 다 활성화 | ||
- | management.port=8081 | + | management.server.port=8081 |
- | management.address=127.0.0.1 | + | management.server.address=127.0.0.1 |
+ | |||
+ | management.server.port=-1 # http endpoint 끄기 | ||
+ | </ | ||
+ | |||
+ | ===== Health Check ===== | ||
+ | * [[https:// | ||
+ | <code java> | ||
+ | import org.springframework.boot.actuate.health.Health; | ||
+ | import org.springframework.boot.actuate.health.HealthIndicator; | ||
+ | import org.springframework.stereotype.Component; | ||
+ | |||
+ | @Component | ||
+ | public class MyHealthIndicator implements HealthIndicator { | ||
+ | |||
+ | @Override | ||
+ | public Health health() { | ||
+ | int errorCode = check(); // perform some specific health check | ||
+ | if (errorCode != 0) { | ||
+ | return Health.down().withDetail(" | ||
+ | } | ||
+ | return Health.up().build(); | ||
+ | } | ||
+ | |||
+ | } | ||
</ | </ | ||
+ | * [[https:// | ||
+ | ===== 참조 ===== | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * [[https:// |