0. Spring Cloud Bus ์ง๋ ํฌ์คํ
์์ Actuator๋ฅผ ์ด์ฉํด์ refresh๋ฅผ ํตํด configuration ์ ๋ณด๋ค์ ๊ฐ์ ธ์ค๋ ๋ฐฉ๋ฒ์ ์ดํด๋ณด์๋ค. ์ด ๋ฐฉ๋ฒ์ ์ฌ์ฉํ๊ฒ ๋๋ค๋ฉด, ์ค์ ์ ๋ณด๊ฐ ๋ฐ๋๋ ๋ง๋ค refresh๋ฅผ ํด์ค์ผ ํ๋ ๋จ์ ์ด ์๋ค. ์์ธํ ๋ด์ฉ์ ๊ณต์ ๋ฌธ์๋ฅผ ์ดํด๋ณด์. https://spring.io/projects/spring-cloud-bus/ Spring Cloud Bus Spring Cloud Bus links nodes of a distributed system with a lightweight message broker. This can then be used to broadcast state changes (e.g. configuration changes) or o..
๋ฌธ์ ํ๋ก์ ํธ ์ ์ฒด๋ฅผ Spring Cloud๋ฅผ ์ด์ฉํ์ฌ ๊ธฐ๋ณธ ๋ผ๋๋ฅผ MSA๊ตฌ์กฐ๋ก ๊ตฌ์ถํ๋ค. ํ์ง๋ง ์ฌ๊ธฐ์ ๋ฌธ์ ๊ฐ ์๊ฒผ๋ค. public class App extends BaseTimeEntity { //... @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "user_id", nullable = false) private User user;} ๊ธฐ์กด์ ์ค๊ณํ๋ App Entity ๋ User Entity์ ์ฐ๊ด๊ด๊ณ ๋งคํ์ผ๋ก ํด๊ฒฐํ๋ ค๊ณ ์ค๊ณํ๋ค. ํ์ง๋ง, ์ง๊ธ ํ๋ก์ ํธ ๊ตฌ์ฑ์ app-service์ user-service๋ฅผ ๋๋์ด ๋์๋ค. ๊ทธ๋์ app-service์์ user๋ฅผ ์ฐธ์กฐํ ์ ์๋ ๊ฒ์ด๋ค. ์ด์ ๊ด๋ จํด์ ๋ช ๊ฐ์ง ๊ธ๋ค์..
0. Spring Cloud Config Server MSA์ ๊ฐ์ ๋ถ์ฐ ์์คํ
์์ ๊ฐ ์๋ฒ๋ค์ ๊ตฌ์ฑ์ ํ์ํ ์ค์ ๋ค์ ์ธ๋ถ ์์คํ
์์ ํ๋ฒ์ ๊ด๋ฆฌํ ์ ์๋ค. Spring Boot ๊ฐ์ ๊ฒฝ์ฐ๋, ์ค์ ํ์ผ์ธ application.yml ๋๋ propertiesํ์ผ์ด ๊ทธ ๋์์ด ๋๊ฒ ๋ค. Spring Cloud์ Config Server๋ฅผ ๊ธฐ๋ํ์ฌ ์ค์ ํ์ผ๋ค์ ํ๊บผ๋ฒ์ ๋ฌถ์ด ์ฌ์ฉํ๋ค๋ฉด, ํ ์ ์ฅ์์์ ๊ด๋ฆฌํ ์ ์๊ณ , ์ค์ ์ ๋ณด๋ฅผ ๋ฐ๊พธ๋๋ผ๋ ๋ค๋ฅธ ์๋น์ค๋ค์ ๋ค์ ๋น๋ํ์ง ์์๋ ๋๋ค. ์๋น์ค๋ฅผ ๊ฐ๋ฐํ๋ ๊ฒฝ์ฐ, DEV์๋ฒ์ PROD ์๋ฒ๋ฅผ ๋ถ๋ฆฌํด์ ๊ฐ๋ฐํ๊ธฐ๋ ํ๋๋ฐ, ๊ฐ ์๋ฒ๋ค ๋ง๋ค ์ฌ์ฉํ๋ ์ค์ ์ ๋ณด๊ฐ ๋ค๋ฅด๊ธฐ ๋๋ฌธ์ ์๋ฒ์ ๋ง์ถฐ์ ๊ธฐ๋ํ ์ ์๊ฒ ๋ค. 1. Actuator ์์์ Config Server..
์ง๋ ํฌ์คํ
์์๋ Eureka Server์ Microservice๋ค์ ๋ฑ๋กํ๋ ์ค์ ์ ์์๋ณด์๋ค. ์ด๋ฒ ์๊ฐ์๋, Eureka Server์ ๋ฑ๋ก๋ ์๋น์ค๋ค์ Routingํ๋ ์ค์ ๋ฐฉ๋ฒ๊ณผ filter๋ฅผ ์์๋ณผ ๊ฒ์ด๋ค. 0. API Gateway Spring Cloud Gateway๋ ๋ฐ๋ ์์ฒญ์ Predicate(์กฐ๊ฑด)์ ๋ฐ๋ผ Filter๋ฅผ ๊ฑฐ์ณ, ๊ฐ Microservice์ Routing์ ํด์ฃผ๋ ์ญํ ์ ํ๋ค. ์ฌ๊ธฐ์ Gateway์๋ฒ๋ Spring์ ๊ธฐ๋ณธ ๋ด์ฅ ์๋ฒ์ธ Tomcat์ ์ฌ์ฉํ์ง ์๊ณ Netty๋ฅผ ์ฌ์ฉํ๋๋ฐ ,Netty๋ ๋น๋๊ธฐ ์ด๋ฒคํธ ๊ธฐ๋ฐ ๋คํธ์ํฌ ์ ํ๋ฆฌ์ผ์ด์
ํ๋ ์์ํฌ์ด๋ค. ์๋ฌด๋๋ Gateway๊ฐ ๋ชจ๋ ์์ฒญ๋ค์ ๋ฐ๊ณ Routingํ๋ ์ญํ ์ ํ๋ค๋ณด๋, ๋น๋๊ธฐ ๋ฐฉ์์ผ๋ก ์ฒ๋ฆฌํ๋๊ฒ ๋..
*Spring Boot 3.2.1, Spring Cloud 2023.0.0 ๋ฒ์ ์์ ํ
์คํธํ์์ต๋๋ค. 1. Eureka Server ์ค์ Micro Service๋ค์ ์ด์ฉํ๊ฒ ๋ Eureka Server์ ๋ํ ์ค์ ์ ์์๋ณด๋๋ก ํ๊ฒ ๋ค. ๋จผ์ , netflix eureka ์์กด์ฑ์ ์ฃผ์
ํด ์ฃผ์ด์ผ ํ๋ค. ... ext { set('springCloudVersion', "2023.0.0") } dependencies { implementation 'org.springframework.cloud:spring-cloud-starter-netflix-eureka-server' } dependencyManagement { imports { mavenBom "org.springframework.cloud:spring-..
Spring Cloud๋ Micro Service Architecture๋ฅผ ์ง์ํ๊ธฐ ์ํ ํ๋ ์ ์ํฌ์ด๋ค. Spring Cloud ๊ณต์๋ฌธ์ https://spring.io/projects/spring-cloud/ Spring Cloud Spring Cloud provides tools for developers to quickly build some of the common patterns in distributed systems (e.g. configuration management, service discovery, circuit breakers, intelligent routing, micro-proxy, control bus, short lived microservices and spring.io..