Config Server 의 Property 를 수정이 됐을때 각 연동된 서비스들은 어떻게해야 정보가 업데이트 될까?
해당 Config Property 를 업데이트 하기 위해 세가지 방법이 있다.
- 서버 재기동 - 서비스를 재기동시키는건 Config 서버를 중앙화한 의미가 없어지게 된다.
- Actuator Refresh
- Application 상태, 모니터링
- Metric 수집을 위한 Httpd End Point 제공
- 이번 예제에서 사용
- Spring Cloud Bus
- 동적으로 Config 변경을 위한 MQ(Message Que) Handler



* https://docs.spring.io/spring-boot/reference/actuator/endpoints.html#page-title
Endpoints :: Spring Boot
If you add a @Bean annotated with @Endpoint, any methods annotated with @ReadOperation, @WriteOperation, or @DeleteOperation are automatically exposed over JMX and, in a web application, over HTTP as well. Endpoints can be exposed over HTTP by using Jersey
docs.spring.io
{server:port}/actuator

활성화된 모든 actuator endpoint 확인 가능
우리의 목적은 config server 에서 광고중인 ecommerce.yml의 property 가 수정됐을때 동적으로 반영을 위해 actuator/refresh 를 이용한다.


다시 설정 정보를 가져오는 모습을 확인할 수 있다.
- 단점 : 마이크로 서비스들을 일일히 refresh 요청을 수동으로 해줘야 함 (사실상 안쓰인다는 의미)
'Spring' 카테고리의 다른 글
| [Spring AI] Spring AI 사용해보기 - ⓵ (기본설정) (0) | 2024.10.10 |
|---|---|
| [Spring] Filter, Interceptor 역할 (0) | 2024.09.05 |
| [Spring Cloud] Spring Cloud Config Server - 2 (0) | 2024.07.18 |
| [Spring Cloud] Spring Cloud Config Server - 1 (0) | 2024.07.18 |
| FileSize Exception 처리 (0) | 2024.07.11 |