๋ฐ˜์‘ํ˜•
์„œ๋น„์Šค ๋””์Šค์ปค๋ฒ„๋ฆฌ (Service Discovery)
์„ค๋ช…

์„œ๋น„์Šค ํด๋ผ์ด์–ธํŠธ๊ฐ€ ๋‹ค๋ฅธ ์„œ๋น„์Šค๋ฅผ ํ˜ธ์ถœ์‹œ, ์„œ๋น„์Šค์˜ ์œ„์น˜(IP, port) ๋ฅผ ์•Œ์•„๋‚ผ ์ˆ˜ ์žˆ๋Š” ๊ธฐ๋Šฅ
๊ด€๋ จ ์˜คํ”ˆ์†Œ์Šค๋กœ ๋„ทํ”Œ๋ฆญ์Šค OSS์˜ ์œ ๋ ˆ์นด(Eureka)๊ฐ€ ์กด์žฌ!

 

์œ ๋ ˆ์นด (Eureka)
์„ค๋ช…

์„œ๋ฒ„๊ฐ€ ์ƒˆ๋กญ๊ฒŒ ์‹œ์ž‘๋˜๋ฉด ๊ทธ๊ฒƒ์„ ๊ฐ์ง€ํ•˜์—ฌ ์ž๋™์œผ๋กœ ์ถ”๊ฐ€๋˜๊ณ , ์„œ๋ฒ„๊ฐ€ ์ข…๋ฃŒ๋˜๋ฉด ์ž๋™์œผ๋กœ ๋ชฉ๋ก์—์„œ ์‚ญ์ œํ•˜๊ธฐ ์œ„ํ•œ ๋ฐฉ๋ฒ• ?!
์œ ๋ ˆ์นด์™€์˜ ํ†ตํ•ฉ์„ ์œ„ํ•œ ์Šคํ”„๋ง ํด๋ผ์šฐ๋“œ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋Š” ํด๋ผ์ด์–ธํŠธ์™€ ์„œ๋ฒ„ ๋‘๋ถ€๋ถ„์œผ๋กœ ๊ตฌ์„ฑ๋˜์–ด์žˆ๋‹ค!

    โ€ฃ ์„œ๋ฒ„
      ๋“ฑ๋ก๋œ ์„œ๋น„์Šค์˜ ๋ชฉ๋ก์„ ์ˆ˜์ง‘ํ•˜๊ธฐ ์œ„ํ•œ API & ์ƒˆ๋กœ์šด ์„œ๋น„์Šค๋ฅผ ๋„คํŠธ์›Œํฌ ์œ„์น˜ ์ฃผ์†Œ์™€ ํ•จ๊ป˜ ๋“ฑ๋กํ•˜๊ธฐ ์œ„ํ•œ API ์œผ๋กœ ๊ตฌ์„ฑ
      ๊ฐ ์„œ๋ฒ„์˜ ์ƒํƒœ๋ฅผ ๋‹ค๋ฅธ ์„œ๋ฒ„๋กœ ๋ณต์ œํ•ด ์„ค์ •ํ•˜๊ณ  ๋ฐฐํฌํ•จ์œผ๋กœ์จ ๊ฐ€์šฉ์„ฑ ๋†’์ผ ์ˆ˜ ์žˆ๋‹ค!
      ์„œ๋น„์Šค์˜ ๊ฐ ์ธ์Šคํ„ด์Šค๋กœ๋ถ€ํ„ฐ ์ƒ์กด์‹ ํ˜ธ(heartbeat) ๋ฉ”์‹œ์ง€๋ฅผ ๋ฐ›๋Š”๋‹ค. ์„ค์ •๋œ ๊ธฐ๊ฐ„๋™์•ˆ ์ƒ์กด์‹ ํ˜ธ๋ฅผ ๋ฐ›์ง€ ๋ชปํ•˜๋ฉด ๋ ˆ์ง€์ŠคํŠธ๋ฆฌ์—์„œ ์„œ๋น„์Šค๊ฐ€ ์‚ญ์ œ๋œ๋‹ค.

    โ€ฃ ํด๋ผ์ด์–ธํŠธ 
      ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ์‹œ์ž‘ ํ›„ ๋“ฑ๋ก & ์ข…๋ฃŒ ์ „ ๋“ฑ๋ก ํ•ด์ œ๋ฅผ ๋‹ด๋‹นํ•˜๊ณ  ์œ ๋ ˆ์ปค ์„œ๋ฒ„๋กœ๋ถ€ํ„ฐ ์ฃผ๊ธฐ์ ์œผ๋กœ ์ตœ์‹  ์„œ๋น„์Šค ๋ชฉ๋ก์„ ๋ฐ›์•„์˜ด!

 

์‹ค์Šต

• eureka server 1๊ฐœ (eureka server) , client server 2๊ฐœ (demo1, demo2)

์œ ๋ ˆ์นด ์„œ๋ฒ„ ๋ฐ ํด๋ผ์ด์–ธํŠธ๋“ค์˜ application.yml ๋“ค

    โ€ฃ eureka.client.service-url.defaultZone ์—๋Š” ์œ ๋ ˆ์นด ์„œ๋ฒ„ ์—ฌ๋Ÿฌ๊ฐœ ์„ค์ •๋„ ๊ฐ€๋Šฅํ•˜๋‹ค

์œ ๋ ˆ์นด ์„œ๋ฒ„ ๋ฐ ํด๋ผ์ด์–ธํŠธ ๋“ค์˜ ์–ด๋…ธํ…Œ์ด์…˜ ์„ค์ •๋“ค

    โ€ฃ @EnableDiscoveryClient: spring-cloud-commons์— ์กด์žฌ
    โ€ฃ @EnableEurekaClient: spring-cloud-netflix์— ์กด์žฌํ•˜๋ฉฐ, ์œ ๋ ˆ์นด๋งŒ์„ ์œ„ํ•ด ์ž‘๋™

 

์œ ๋ ˆ์นด ์„œ๋ฒ„ ๋ฐ ํด๋ผ์ด์–ธํŠธ๋“ค์˜ build.gradle ์„ค์ •๋“ค


    โ€ฃ spring-cloud-starter-eureka-server vs spring-cloud-starter-netflix-eureka-server : ์ฐจ์ด์—†์Œ. ๊ทผ๋ฐ netflix ๋ถ™์€๊ฒƒ์„ ๊ถŒ์žฅํ•˜๋Š”๋“ฏ

 

 


์ฐธ๊ณ 

๋งํฌ: https://bcho.tistory.com/1252

 

MSA์—์„œ Service discovery ํŒจํ„ด

MSA์—์„œ Service discovery ํŒจํ„ด์˜ ์ดํ•ด ์กฐ๋Œ€ํ˜‘ (http://bcho.tistory.com) MSA์™€ ๊ฐ™์€ ๋ถ„์‚ฐ ํ™˜๊ฒฝ์€ ์„œ๋น„์Šค ๊ฐ„์˜ ์›๊ฒฉ ํ˜ธ์ถœ๋กœ ๊ตฌ์„ฑ์ด ๋œ๋‹ค. ์›๊ฒฉ ์„œ๋น„์Šค ํ˜ธ์ถœ์€ IP ์ฃผ์†Œ์™€ ํฌํŠธ๋ฅผ ์ด์šฉํ•˜๋Š” ๋ฐฉ์‹์ด ๋˜๋Š”๋‹ค. ํด๋ผ

bcho.tistory.com

๋งํฌ: https://stackoverflow.com/questions/49885718/difference-between-spring-cloud-starter-eureka-server-and-spring-cloud-starte

 

 

difference between `spring-cloud-starter-eureka-server` and `spring-cloud-starter-netflix-eureka-server`

I am new to the Spring Cloud, what is the exact difference between spring-cloud-starter-eureka-server and spring-cloud-starter-netflix-eureka-server ? When we should go for spring-cloud-starter-e...

stackoverflow.com

์ฑ…: ๋งˆ์Šคํ„ฐ๋ง ์Šคํ”„๋ง ํด๋ผ์šฐ๋“œ

๋ฐ˜์‘ํ˜•

+ Recent posts