Posts SIY Spring Cloud Eureka
Post
Cancel

SIY Spring Cloud Eureka

Eureka


๐Ÿ’ฟ Eureka

์œ ๋ ˆ์นด๋Š” ํด๋ผ์ด์–ธํŠธ์™€ ์„œ๋ฒ„๋กœ ๋‚˜๋‰˜์–ด์ € ์žˆ๋‹ค.

  • ์œ ๋ ˆ์นด ์„œ๋ฒ„
    • ๋ชจ๋“  ๋งˆ์ดํฌ๋กœ ์„œ๋น„์Šค๊ฐ€ ์ž์‹ ์˜ ๊ฐ€์šฉ์„ฑ์„ ๋“ฑ๋กํ•˜๋Š” ๋ ˆ์ง€์ŠคํŠธ๋ฆฌ
    • ๋“ฑ๋ก๋˜๋Š” ์ •๋ณด๋Š” ์„œ๋น„์Šค ID ์™€ URL์ด ํฌํ•จ๋˜๋Š”๋ฐ ์œ ๋ ˆ์นด ํด๋ผ์ด์–ธํŠธ๋ฅผ ํ†ตํ•ด์„œ ์ด ์ •๋ณด๋ฅผ ์„œ๋ฒ„์— ๋“ฑ๋ก
    • ๋“ฑ๋ก๋œ ์ •๋ณด๋ฅผ ํ†ตํ•ด์„œ ์„œ๋น„์Šค์˜ ๋™์  ๋ฐœ๊ฒฌ์ด ๊ฐ€๋Šฅ
  • ์œ ๋ ˆ์นด ํด๋ผ์ด์–ธํŠธ
    • ๋“ฑ๋ก๋œ ๋งˆ์ดํฌ๋กœ ์„œ๋น„์Šค๋ฅผ ํ˜ธ์ถœํ•ด์„œ ์‚ฌ์šฉํ•  ์œ ๋ ˆ์นด ํด๋ผ์ด์–ธํŠธ๋ฅผ ๋ฐœ๊ฒฌ(gateway)
    • ์œ ๋ ˆ์นด ์„œ๋ฒ„๋Š” ๋™์‹œ์— ์œ ๋ ˆ์นด ํด๋ผ์ด์–ธํŠธ์ด๊ธฐ๋„ ํ•ด์„œ ๋‹ค๋ฅธ ์œ ๋ ˆ์นด ์„œ๋ฒ„์™€ ์ƒํƒœ๋ฅผ ๋™๊ธฐํ™” ํ•จ
    • ์—ฌ๋Ÿฌ๋Œ€์˜ ์œ ๋ ˆ์นด ์„œ๋ฒ„๋ฅผ ์šด์˜์‹œ ๊ณ ๊ฐ€์šฉ์„ฑ

image Service Discovery: Eureka Server / Service Router: Api Gateway


๐Ÿ’ฟ Eureka ๊ตฌ์ถ•

Eureka Server

์ฃผ์š” Component

  • @EnableEurekaServer(main ํด๋ž˜์Šค): ์— ๋ถ™์ด๋ฉฐ ์œ ๋ ˆ์นด ์„œ๋ฒ„๋ฅผ ์“ฐ๊ฒ ๋‹ค๋Š” ๋œป
    • ์—ฌ๊ธฐ ์„œ๋ฒ„์˜ index๋ฅผ ํ˜ธ์ถœํ•˜๋ฉด ํ˜„์žฌ ๊ฐ€์šฉ ์ƒํƒœ์˜ ์„œ๋ฒ„๋ฅผ ๋ณผ ์ˆ˜ ์žˆ์Œ
  • register-with-eureka(yml)
    • ๋ ˆ์ง€์ŠคํŠธ๋ฆฌ์— ์ž์‹ ์„ ๋“ฑ๋กํ• ์ง€ ์—ฌ๋ถ€
    • ํด๋Ÿฌ์Šคํ„ฐ๋ง ๋ชจ๋“œ์˜ ์œ ๋ ˆ์นด ์„œ๋ฒ„ ๊ตฌ์„ฑ์€ ์„œ๋กœ peering ๊ตฌ์„ฑ์ด ๊ฐ€๋Šฅ. (์œ ๋ ˆ์นด ์„œ๋ฒ„ ์„ค์ •์— ์ •์˜๋œ peering ๋…ธ๋“œ๋ฅผ ์ฐพ์•„์„œ ๋ ˆ์ง€์ŠคํŠธ๋ฆฌ ์ •๋ณด์˜ sync๋ฅผ ๋งž์ถค)
  • fetch-registry(yml)
    • ๋ ˆ์ง€์ŠคํŠธ๋ฆฌ์— ์žˆ๋Š” ์ •๋ณด๋ฅผ ๊ฐ€์ ธ์˜ฌ ์ง€์— ๋Œ€ํ•œ ์—ฌ๋ถ€
  • wait-time-in-ms-when-sync-empty
    • registry๋ฅผ ๊ฐฑ์‹ ํ•  ์ˆ˜ ์—†์„๋•Œ ์žฌ์‹œ๋„๋ฅผ ๊ธฐ๋‹ค๋ฆฌ๋Š” ์‹œ๊ฐ„
    • ํ…Œ์ŠคํŠธ ์‹œ ์งง์€ ์‹œ๊ฐ„์œผ๋กœ ๋“ฑ๋กํ•ด๋†“์œผ๋ฉด ์œ ๋ ˆ์นด ์„œ๋น„์Šค์˜ ์‹œ์ž‘ ์‹œ๊ฐ„๊ณผ ๋“ฑ๋ก๋œ ์„œ๋น„์Šค๋ฅผ ๋ณด์—ฌ์ฃผ๋Š” ์‹œ๊ฐ„ ๋‹จ์ถ• ๊ฐ€๋Šฅ
    • ์œ ๋ ˆ์นด๋Š” ๋“ฑ๋ก๋œ ์„œ๋น„์Šค์—์„œ 10์ดˆ ๊ฐ„๊ฒฉ์œผ๋กœ ์—ฐ์† 3ํšŒ์˜ ์ƒํƒœ ์ •๋ณด(heartbeat)๋ฅผ ๋ฐ›์•„์•ผ ํ•˜๋ฏ€๋กœ ๋“ฑ๋ก๋œ ๊ฐœ๋ณ„ ์„œ๋น„์Šค๋ฅผ ๋ณด์—ฌ์ฃผ๋Š”๋ฐ 30์ดˆ ์†Œ์š”

์ฃผ์˜ ์‚ฌํ•ญ

  • ์œ ๋ ˆ์นด ํด๋ผ์ด์–ธํŠธ๋ฅผ 1๊ฐœ ๊ตฌ์„ฑํ•  ๋•Œ๋Š” register-with-eureka, fetch-registry ๋‘˜๋‹ค false
This post is licensed under CC BY 4.0 by the author.

Operation System 6 file

authentication-jwt