ํ‹ฐ์Šคํ† ๋ฆฌ ๋ทฐ

๋ฐ˜์‘ํ˜•

โœ… Springboot graceful shutdown ์ ์šฉํ•˜๊ธฐ

์„œ๋ฒ„์— ์„œ๋น„์Šค๋ฅผ ๋ฐ˜์˜ ํ• ๋•Œ ์„œ๋น„์Šค๋ฅผ ์ข…๋ฃŒ์ฒ˜๋ฆฌํ•ด์•ผํ•˜๋Š”๋ฐ ์ข…๋ฃŒ ์‹œ์ ์— ์ด๋ฏธ ์ธ์ž…๋œ ์š”์ฒญ๋“ค์„ ์ฒ˜๋ฆฌ ํ•˜๊ณ  ์ข…๋ฃŒ๋˜๋„๋ก graceful shutdown์„ ์ ์šฉํ•ด๋ณด์ž. (springboot 2.3 ์ด์ƒ๋ถ€ํ„ฐ graceful shutdown ์ง€์›)

 

โœ… application.yaml ์ถ”๊ฐ€

## springboot application.yaml ์ˆ˜์ •
## graceful shutdown์‹œ ์–ผ๋งŒํผ ๋Œ€๊ธฐํ•˜๋„๋ก ํ• ์ง€ ์…‹ํŒ…
spring:
  lifecycle:
    timeout-per-shutdown-phase: 10s
        
server:
  shutdown: graceful

์š”๊ธฐ ๊นŒ์ง€ ์…‹ํŒ…์„ ํ–ˆ์œผ๋ฉด graceful shutdown์ด ์ ์šฉ ๋œ๊ฑฐ๋‹ค.

ํ•˜์ง€๋งŒ ์„œ๋ฒ„์—์„œ killํ• ๋•Œ 

kill -9 pid ๋กœ ์ •์ง€์‹œํ‚ค๊ฒŒ ๋˜๋ฉด -9๊ฐ€ ๊ฐ•์ œ์ข…๋ฃŒ ์˜ต์…˜์ด๊ธฐ ๋•Œ๋ฌธ์— graceful shutdown์ด ์•ˆ๋œ๋‹ค.

kill -15 pid ๋กœ ์ •์ง€ํ•ด์„œ ์ž์‹ ์ด ํ•˜๋˜ ์ž‘์—…์„ ์™„๋ฃŒํ›„์— ์ข…๋ฃŒํ•˜๋„๋ก  kill -15 pid๋กœ ์ข…๋ฃŒ์‹œ์ผœ์•ผ graceful shutdonw์ด ๋™์ž‘ํ•ฉ๋‹ˆ๋‹ค.

 

kill -15 pid ๋กœ ์„œ๋น„์Šค ์ข…๋ฃŒ์‹œ ๋กœ๊ทธํ™•์ธํ•ด๋ณด๋ฉด graceful shutdown complete๋ฅผ ํ™•์ธํ•ด๋ณผ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

 

๊ณต์ง€์‚ฌํ•ญ
์ตœ๊ทผ์— ์˜ฌ๋ผ์˜จ ๊ธ€
์ตœ๊ทผ์— ๋‹ฌ๋ฆฐ ๋Œ“๊ธ€
Total
Today
Yesterday
๋งํฌ
ยซ   2024/12   ยป
์ผ ์›” ํ™” ์ˆ˜ ๋ชฉ ๊ธˆ ํ† 
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31
๊ธ€ ๋ณด๊ด€ํ•จ
๋ถ„๋ฅ˜ ์ „์ฒด๋ณด๊ธฐ (80)
๐Ÿ“บ Develop (0)
๐ŸŒ‹ Error Fixed (5)
๐Ÿ— Tool (5)
๐Ÿ’ป MacBook M1 (15)
๐Ÿ“ฆ ETC (1)

์ด ํฌ์ŠคํŒ…์€ ์ฟ ํŒก ํŒŒํŠธ๋„ˆ์Šค ํ™œ๋™์˜ ์ผํ™˜์œผ๋กœ, ์ด์— ๋”ฐ๋ฅธ ์ผ์ •์•ก์˜ ์ˆ˜์ˆ˜๋ฃŒ๋ฅผ ์ œ๊ณต๋ฐ›์Šต๋‹ˆ๋‹ค.