BackEnd

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..
ddonghyeo
'BackEnd' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๊ธ€ ๋ชฉ๋ก (4 Page)