2024/๊ฐœ๋ฐœ

Spring Batch ๊ด€๋ฆฌ ๋„๊ตฌ Jenkins ๋Œ€์•ˆ ํƒ์ƒ‰๊ธฐ

mjin.park 2024. 7. 28. 23:48

๐Ÿ“ ๊ฐœ์š”

Spring Batch ๊ธฐ๋ฐ˜ ๋ฐฐ์น˜ ์ž‘์—…์˜ ์Šค์ผ€์ฅด๋ง ๋ฐ ์ด๋ ฅ ํ™•์ธํ•˜๋Š”๋ฐ Jenkins๋ฅผ ๊ฐ€์žฅ ๋งŽ์ด ์‚ฌ์šฉํ•œ๋‹ค.

Jenkins๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด์„œ ๋Š๋‚€ ๋ถˆํŽธํ•จ๋“ค์ด ์žˆ์—ˆ๋‹ค.

    • (๊ฐ€์žฅ ํฐ ๋ถˆํŽธํ•จ) ๋ˆ์„ ๋‚ด์ง€ ์•Š์œผ๋ฉด ์ด์ค‘ํ™”๋ฅผ ํ•˜๊ธฐ ๊นŒ๋‹ค๋กญ๋‹ค. ThinBackup ? NAS ?
    • Spring Batch ์ž‘์—…์„ ๋“ฑ๋กํ•˜๊ธฐ ์œ„ํ•œ ๋ณ„๋„ Jenkins ์„ค์ • or Jenkinsfile์„ ๋งŒ๋“ค์–ด์•ผ ํ•œ๋‹ค.

Jenkins๋„ ์ข‹์ง€๋งŒ, ๋‹ค๋ฅธ ๋Œ€์•ˆ์ด ์—†์„์ง€ ์ฐพ์•„๋ณด๋Š” ๊ทธ ๊ณผ์ •์„ ๊ณต์œ ํ•˜๊ณ ์ž ํ•œ๋‹ค.

๐Ÿ” Spring Batch ๊ด€๋ฆฌ ๋„๊ตฌ Jenkins ๋Œ€์•ˆ ํƒ์ƒ‰๊ธฐ

Spring Batch ๊ด€๋ฆฌ ๋„๊ตฌ Jenkins ๋Œ€์•ˆ์„ ์ฐพ์•„๋ณด์ž.

Spring Batch ๊ด€๋ฆฌ ๋„๊ตฌ๋กœ์จ ์ ์ ˆํ•˜๋‹ค๊ณ  ํŒ๋‹จํ•˜๋Š” ๊ธฐ์ค€์€ ๋‹ค์Œ๊ณผ ๊ฐ™๋‹ค.

  • IDC ์ด์ค‘ํ™”๋ฅผ ์ œ๊ณตํ•˜๋Š”๊ฐ€ (์ˆ˜๋™ํƒœ๋ง๊ณ  ๋Šฅ๋™ํƒœ๋กœ ๋ง์ด๋‹ค.)
  • ๋ฐฐ์น˜ ์ž‘์—… ์ˆ˜ํ–‰ ์ด๋ ฅ ํŒŒ์•…์ด ์šฉ์ดํ•œ๊ฐ€
  • ๋ฐฐ์น˜ ์ž‘์—…์˜ ์˜ํ–ฅ์œผ๋กœ ์„œ๋ฒ„ ๋ฆฌ์†Œ์Šค์— ์ด์Šˆ๊ฐ€ ๋ฐœ์ƒํ•˜์ง€ ์•Š๋Š”๊ฐ€
  • ๊ด€๋ฆฌ ๋„๊ตฌ๊ฐ€ ์ง€์†์ ์œผ๋กœ ์œ ์ง€๋ณด์ˆ˜๋˜๊ณ  ์žˆ๋Š”๊ฐ€
  • ๊ด€๋ฆฌ ๋„๊ตฌ์˜ ์ปค๋ฎค๋‹ˆํ‹ฐ๊ฐ€ ํ™œ์„ฑํ™”๋˜์–ด ์žˆ๋Š”๊ฐ€

Spring Batch Admin

Spring Batch Job์„ ๊ด€๋ฆฌํ•˜๊ณ  ๋ชจ๋‹ˆํ„ฐ๋ง ํ•  ์ˆ˜ ์žˆ๋Š” ์›น ์•ฑ์ด๋‹ค.

๊ณต์‹ GitHub Repo์—์„œ๋„ ๋งํ•˜๊ณ  ์žˆ๋“ฏ์ด ๋”์ด์ƒ ์‚ฌ์šฉํ•˜์ง€ ๋ง๊ณ  Spring Cloud Data Flow๋ฅผ ์‚ฌ์šฉํ•˜๊ธธ ๊ถŒ์žฅํ•˜๊ณ  ์žˆ๋‹ค.

https://github.com/spring-attic/spring-batch-admin

 

GitHub - spring-attic/spring-batch-admin: Spring Batch Admin: runtime application and utilities for running Jobs with Spring Bat

Spring Batch Admin: runtime application and utilities for running Jobs with Spring Batch - spring-attic/spring-batch-admin

github.com

Spring Cloud Data Flow

Spring Cloud Data Flow(SCDF)๋Š” Steaming, Batch ์ž‘์—…์„ ์ˆ˜ํ–‰ํ•˜๋Š” ๊ฒƒ์„ ๋„์™€์ฃผ๋Š” ๋„๊ตฌ์ด๋‹ค.

์œ„์—์„œ๋„ ์–ธ๊ธ‰ํ–ˆ๋˜ ๋ฐ”์™€ ๊ฐ™์ด Spring์—์„œ ๊ถŒ์žฅ๋˜๋Š” ๋ฐฉ์‹์ด๋‹ค.

๊ธฐ์กด Spring Batch์˜ Job์ด ์•„๋‹ˆ๋ผ Spring Cloud Task๋ผ๋Š” ๋‹จ์œ„๋กœ ๊ด€๋ฆฌ๋œ๋‹ค.

๊ธฐ์กด Spring Batch ๊ธฐ๋ฐ˜ ์ฝ”๋“œ๋“ค์„ ๊ทธ๋Œ€๋กœ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋Š”์ง€๋„ ์ฃผ์š” ๊ฒ€ํ†  ํฌ์ธํŠธ๊ฐ€ ๋  ๊ฒƒ ๊ฐ™๋‹ค.

Spring Batch ๋ฉ”ํƒ€๋ฐ์ดํ„ฐ(e.g. Job Paratmeter)๊ฐ€ ํฌํ•จ๋œ ๋Œ€์‹œ๋ณด๋“œ๋ฅผ ์ œ๊ณตํ•œ๋‹ค.

https://spring.io/projects/spring-cloud-dataflow

 

Spring Cloud Data Flow

Microservice based Streaming and Batch data processing for Cloud Foundry and Kubernetes. Spring Cloud Data Flow provides tools to create complex topologies for streaming and batch data pipelines. The data pipelines consist of Spring Boot apps, built using

spring.io

Spring Scheduler

Spring Scheduler๋Š” ์Šค์ผ€์ฅด๋ง์— ๋”ฐ๋ผ ์ •ํ•ด์ง„ ์ž‘์—…์„ ์ˆ˜ํ–‰ํ•ด์ฃผ๋Š” ๊ธฐ๋Šฅ? ๋ชจ๋“ˆ? ์ด๋‹ค.

์ž๋™์œผ๋กœ ์ž‘์—…์„ ์ˆ˜ํ–‰ํ•ด์ฃผ๋Š” ๊ธฐ๋Šฅ์„ ์ œ๊ณตํ•˜์ง€๋งŒ, ๋‹ค์ค‘ ์ธ์Šคํ„ด์Šค ํ™˜๊ฒฝ์—์„œ ๋™์‹œ ์ˆ˜ํ–‰์„ ๋ง‰๊ธฐ ์œ„ํ•ด ์ฃผ๋กœ Quartz์™€ ๊ฐ™์ด ์‚ฌ์šฉ๋œ๋‹ค.
Spring Scheduler๋กœ ์ˆ˜ํ–‰ํ•˜๋Š” ๊ฒฝ์šฐ Spring Application์ด ๋„์›Œ์ง„์ฑ„๋กœ ๋ฆฌ์†Œ์Šค๋ฅผ ๊ณ„์† ์‚ฌ์šฉํ•œ๋‹ค.

๊ทธ๋ฆฌ๊ณ  Spring Batch์™€ ๊ฐ™์€ ๋ฆฌ์†Œ์Šค๋ฅผ ๊ณต์œ ํ•จ์œผ๋กœ์จ ์Šค์ผ€์ฅด๋ง๊ณผ ๋ฐฐ์น˜ ์ž‘์—… ๊ฐ„์˜ ์˜ํ–ฅ์„ ๋ฐ›์„ ์ˆ˜ ์žˆ๋Š” ๊ตฌ์กฐ์ด๋‹ค.

์˜ˆ๋ฅผ ๋“ค๋ฉด, ๋ฐฐ์น˜ ์ž‘์—…์„ ์ˆ˜ํ–‰ํ•˜๋‹ค๊ฐ€ OOM์ด ๋ฐœ์ƒํ•˜๋ฉด ํ”„๋กœ์„ธ์Šค๊ฐ€ ๋‹ค์šด๋˜์–ด ์Šค์ผ€์ฅด๋ง๊ณผ ๋ฐฐ์น˜ ์ž‘์—… ๋ชจ๋‘ ์ˆ˜ํ–‰๋˜์ง€ ๋ชปํ•œ๋‹ค.

https://github.com/spring-guides/gs-scheduling-tasks

 

GitHub - spring-guides/gs-scheduling-tasks: Scheduling Tasks :: Learn how to schedule tasks with Spring.

Scheduling Tasks :: Learn how to schedule tasks with Spring. - spring-guides/gs-scheduling-tasks

github.com

K8s CronJob

K8s ํ™˜๊ฒฝ์—์„œ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋Š” ์Šค์ผ€์ฅด ์ž‘์—… ๋ฆฌ์†Œ์Šค์ด๋‹ค.

์Šค์ผ€์ฅด๋ง ํ˜„ํ™ฉ์ด๋‚˜ ์ˆ˜ํ–‰ ๊ฒฐ๊ณผ ์ด๋ ฅ ๊ด€๋ฆฌ, ๋ชจ๋‹ˆํ„ฐ๋ง ๋“ฑ์˜ ๋ถˆํŽธํ•จ์ด ์žˆ์–ด์„œ ์‹ค์ œ ์šด์˜ ๋„๊ตฌ๋กœ ์‚ฌ์šฉํ•˜๊ธฐ ์–ด๋ ต๋‹ค๊ณ  ์ƒ๊ฐํ•œ๋‹ค.

CronJob์œผ๋กœ๋งŒ ๊ตฌ์„ฑํ•˜๋Š” ๊ฒฝ์šฐ ๋ณ„๋„๋กœ ์ž์ฒด ๊ตฌ์ถ•ํ•ด์•ผํ•˜๋Š” ๊ธฐ๋Šฅ๋“ค์ด ๋งŽ๋‹ค.

https://kubernetes.io/ko/docs/tasks/job/automated-tasks-with-cron-jobs/

 

ํฌ๋ก ์žก(CronJob)์œผ๋กœ ์ž๋™ํ™”๋œ ์ž‘์—… ์‹คํ–‰

ํฌ๋ก ์žก์„ ์ด์šฉํ•˜์—ฌ ์žก(Job)์„ ์‹œ๊ฐ„ ๊ธฐ๋ฐ˜์˜ ์Šค์ผ€์ค„์— ๋”ฐ๋ผ ์‹คํ–‰ํ•  ์ˆ˜ ์žˆ๋‹ค. ์ด๋Ÿฌํ•œ ์ž๋™ํ™”๋œ ์žก์€ ๋ฆฌ๋ˆ…์Šค ๋˜๋Š” ์œ ๋‹‰์Šค ์‹œ์Šคํ…œ์˜ ํฌ๋ก  ์ž‘์—…์ฒ˜๋Ÿผ ์‹คํ–‰๋œ๋‹ค. ํฌ๋ก  ์žก์€ ๋ฐฑ์—…์„ ์ˆ˜ํ–‰ํ•˜๊ฑฐ๋‚˜ ์ด๋ฉ”์ผ์„

kubernetes.io

Airflow

ํŒŒ์ด์ฌ ๊ธฐ๋ฐ˜์˜ Workflow๋ฅผ ์ •์˜ํ•˜๊ณ  ์Šค์ผ€์ฅด๋ง ๋ฐ ๋ชจ๋‹ˆํ„ฐ๋งํ•˜๊ธฐ ์œ„ํ•œ ์˜คํ”ˆ์†Œ์Šค ํ”Œ๋žซํผ์ด๋‹ค.

Schduler ์—ญํ• ๋กœ ์ž˜ ์ˆ˜ํ–‰๋  ์ˆ˜ ์žˆ๋Š” ์ •๋„๋กœ๋งŒ ์‚ฌ์šฉ๋  ์ˆ˜ ์žˆ์„ ๊ฒƒ ๊ฐ™๋‹ค.

์ถ”๊ฐ€๋กœ Workflow์™€ Job์„ ๋‚˜๋ˆ ์„œ ๊ฐ™์ด ์‚ฌ์šฉํ•˜๋Š” ๊ฒฝ์šฐ์—๋Š” ๋” ํ™œ์šฉ๋„๋Š” ๋†’์„ ์ˆ˜ ์žˆ์œผ๋‚˜ ๋ณต์žก๋„๋‚˜ ๊ด€๋ฆฌํฌ์ธํŠธ๊ฐ€ ๋งŽ์ด ๋Š˜์–ด๋‚  ๊ฒƒ ๊ฐ™๋‹ค.

์ด ๋ถ€๋ถ„์€ Jenkins์—์„œ๋„ ๋™์ผํ•˜๊ฒŒ ๋ฐœ์ƒํ•  ์ˆ˜ ์žˆ๋Š” ๋ถ€๋ถ„์œผ๋กœ ๋กœ์ง ์ˆ˜ํ–‰๊ณผ ์Šค์ผ€์ฅด๋Ÿฌ์˜ ์—ญํ• ์„ ์ž˜ ๋ถ„๋ฆฌํ•ด์„œ ์“ฐ๋„๋ก ๋…ธ๋ ฅ ์ค‘์ด๋‹ค.

https://github.com/apache/airflow

 

GitHub - apache/airflow: Apache Airflow - A platform to programmatically author, schedule, and monitor workflows

Apache Airflow - A platform to programmatically author, schedule, and monitor workflows - apache/airflow

github.com

๐Ÿ’ฌ ๋งบ์Œ๋ง

์ง€๊ธˆ๋„ Jenkins๋ฅผ ๋ฉ”์ธ์œผ๋กœ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ์–ด์š”.

Spring Cloud Data Flow๋ฅผ ์กฐ๊ธˆ ๋” ์‚ดํŽด๋ณผ ์ƒ๊ฐ์ž…๋‹ˆ๋‹ค.

 

ํ˜„์žฌ๋„ ์ ์ ˆํ•œ Spring Batch ๊ด€๋ฆฌ ๋„๊ตฌ๋ฅผ ์ฐพ์œผ๋Ÿฌ ๋‹ค๋‹ˆ๊ณ  ์žˆ์–ด์š”. ๐ŸšŒ

์ข‹์€ ๋„๊ตฌ๊ฐ€ ์žˆ๋‹ค๋ฉด ๋Œ“๊ธ€๋กœ ์•Œ๋ ค์ฃผ์„ธ์š”. ๐Ÿ™‡‍โ™‚๏ธ

 

๋‹ค์Œ ํŽธ์€ [2024/๊ฐœ๋ฐœ] - Spring Cloud Data Flow ๋กœ์ปฌ ๊ตฌ์ถ•๊ธฐ๋กœ ์ฐพ์•„๋ต™๊ฒ ์Šต๋‹ˆ๋‹ค.

๋ฐ˜์‘ํ˜•

'2024 > ๊ฐœ๋ฐœ' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ๊ธ€

Spring Cloud Data Flow ํ†บ์•„๋ณด๊ธฐ - Architecture (1)  (0) 2024.08.10
Spring Cloud Data Flow ๋กœ์ปฌ ๊ตฌ์ถ•๊ธฐ  (0) 2024.08.01
GenAI ? LLM ?  (2) 2024.04.22