Section 8: Spring Cloud Bus - KwangtaekJung/MSA-SpringCloud-user-service GitHub Wiki

Section 8: Spring Cloud Bus

  • Spring Cloud Bus
  • RabbitMQ ์„ค์น˜
  • ํ”„๋กœ์ ํŠธ ์ˆ˜์ • - Actuator ์ถ”๊ฐ€
  • ํ…Œ์ŠคํŠธ

Spring Cloud bus

  • Previous - Changed cofnguration values

    • ์„œ๋ฒ„ ์žฌ๊ธฐ๋™ =>์„œ๋ฒ„๋ฅผ ์žฌ๊ธฐ๋™ํ•ด์•ผ ํ•˜๋ฏ€๋กœ ์˜๋ฏธ ์—†์Œ.
    • Actuator refresh =>์ˆ˜์‹ญ~์ˆ˜๋ฐฑ๋Œ€์˜ Microservice์— ๋ชจ๋‘ refresh๋ฅผ ๋‚ ๋ ค์ค˜์•ผ ํ•˜๋ฏ€๋กœ ๋งค์šฐ ๋ฒˆ๊ฑฐ๋กญ๋‹ค.
  • ์—ฌ๊ธฐ์„œ๋Š” Spring cloud bus ์‚ฌ์šฉํ•ด ๋ณด์ž!!

    • ๋ถ„์‚ฐ ์‹œ์Šคํ…œ์˜ ๋…ธ๋“œ๋ฅผ ๊ฒฝ๋Ÿ‰ ๋ฉ”์‹œ์ง€ ๋ธŒ๋กœ์ปค์™€ ์—ฐ๊ฒฐ
    • ์ƒํƒœ ๋ฐ ๊ตฌ์„ฑ์— ๋Œ€ํ•œ ๋ณ€๊ฒฝ ์‚ฌํ•ญ์„ ์—ฐ๊ฒฐ๋œ ๋…ธ๋“œ์—๊ฒŒ ์ „๋‹ฌ (Broadcast)
  • Spring Cloud Bus

    • AMQP (Advanced Message Queuing Protocol), ๋ฉ”์‹œ์ง€ ์ง€ํ–ฅ ๋ฏธ๋“ค์›จ์–ด๋ฅผ ์œ„ํ•œ ๊ฐœ๋ฐฉํ˜• ํ‘œ์ค€ ์‘์šฉ ๊ณ„์ธต ํ”„๋กœํ† ์ฝœ
      • ๋ฉ”์‹œ์ง€ ์ง€ํ–ฅ, ํ์ž‰, ๋ผ์šฐํŒ… (P2P, Publisher-Subcriber), ์‹ ๋ขฐ์„ฑ, ๋ณด์•ˆ
      • Erlang, RabbitMQ์—์„œ ์‚ฌ์šฉ
    • Kakka ํ”„๋กœ์ ํŠธ
      • Apache Sofrware Foundation์ด Scala ์–ธ์–ด๋กœ ๊ฐœ๋ฐœํ•œ ์˜คํ”ˆ ์†Œ์Šค ๋ฉ”์‹œ์ง€ ๋ธŒ๋กœ์ปค ํ”„๋กœ์ ํŠธ
      • ๋ถ„์‚ฐํ˜• ์ŠคํŠธ๋ฆฌ๋ฐ ํ”Œ๋žซํผ
      • ๋Œ€์šฉ๋Ÿ‰์˜ ๋ฐ์ดํ„ฐ๋ฅผ ์ฒ˜๋ฆฌ ๊ฐ€๋Šฅํ•œ ๋ฉ”์‹œ์ง• ์‹œ์Šคํ…œ
    • RabbitMQ vs Kakfa
      • RabbitMQ
        • ๋ฉ”์‹œ์ง€ ๋ธŒ๋กœ์ปค
        • ์ดˆ ๋‹น 20+ ๋ฉ”์‹œ์ง€๋ฅผ ์†Œ๋น„์ž์—๊ฒŒ ์ „๋‹ฌ
        • ๋ฉ”์‹œ์ง€ ์ „๋‹ฌ ๋ณด์žฅ, ์‹œ์Šคํ…œ ๊ฐ„ ๋ฉ”์‹œ์ง€ ์ „๋‹ฌ
        • ๋ธŒ๋กœ์ปค, ์†Œ๋น„์ž ์ค‘์‹ฌ
      • Kafka
        • ์ดˆ ๋‹น 100k+ ์ด์ƒ์˜ ๋Œ€๋Ÿ‰์˜ ์ด๋ฒคํŠธ ์ฒ˜๋ฆฌ
        • Pub/Sub Topic์— ๋ฉ”์‹œ์ง€ ์ „๋‹ฌ
        • Ack๋ฅผ ๊ธฐ๋‹ค๋ฆฌ์ง€ ์•Š๊ณ  ์ „๋‹ฌ ๊ฐ€๋Šฅ
        • ์ƒ์‚ฐ์ž ์ค‘์‹ฌ
  • Actuator bus-refresh Endpoint

    • ๋ถ„์‚ฐ ์‹œ์Šคํ…œ์˜ ๋…ธ๋“œ๋ฅผ ๊ฒฝ๋Ÿ‰ ๋ฉ”์‹œ์ง€ ๋ธŒ๋กœ์ปค์™€ ์—ฐ๊ฒฐ
    • ์ƒํƒœ ๋ฐ ๊ตฌ์„ฑ์— ๋Œ€ํ•œ ๋ณ€๊ฒฝ ์‚ฌํ•ญ์„ ์—ฐ๊ฒฐ๋œ ๋…ธ๋“œ์—๊ฒŒ ์ „๋‹ฌ (Broadcast)
  • RabbitMQ ์„ค์น˜