'데이터 엔지니어'로 성장하기

정리하는 걸 좋아하고, 남이 읽으면 더 좋아함

Data/Airflow

Airflow) 2.0부터는 scheduler 는 replica 여러개 설정 추천

MightyTedKim 2022. 4. 28. 22:22
728x90
반응형

2.0에서 큰 변화 중 하나는 scheudler의 확장성과 자원 여유로 여러개 띄울 수 있어요!

요약

1. airflow scheduler 가 다시 올라오지 않음

2. 재시작하면 정상 작동됨

3. 원인을 찾아야함

 

설명

1. airflow scheduler 가 다시 올라오지 않음

$k get all -n airflow | grep pod
NAME                                    READY   STATUS            RESTARTS        AGE
pod/airflow-postgresql-0                1/1     Running           1 (69d ago)     108d
pod/airflow-scheduler-88588ff5c-cgpfk   0/3     PodInitializing   3 (6d19h ago)   10d
pod/airflow-statsd-5df44cb959-h64bn     1/1     Running           2 (65d ago)     108d
pod/airflow-webserver-ffc95467d-n8sh8   1/1     Running           0               35d

2. 재시작하면 정상 작동됨

 

3. 원인을 찾아야함

 

동시에 여러 잡들이 돌아서, 부하가 limit에 도달하면 문제가 생길 수 있다고 astronomer 문서에서 언급함
AIRFLOW 2.0에서 이를 해결하기 위해 active active 가능하도록 수정이됨

Though Airflow task execution has always been scalable, 
the Airflow Scheduler itself was (until now) a single point of failure and not horizontally scalable. 
We at Astronomer saw this scalability as crucial to Airflow’s continued growth, 
and therefore attacked this issue with three main areas of focus:

그래서 replicaset을 2개로 늘려서 테스트 중

좀 더 찾아보고 다시 업데이트 예정

- livenessprob 설정을 늘려보라는 이야기가 있어서 참고할 예쩡

helm 기본 설정

# Airflow scheduler settings
scheduler:
  # If the scheduler stops heartbeating for 5 minutes (5*60s) kill the
  # scheduler and let Kubernetes restart it
  livenessProbe:
    initialDelaySeconds: 10
    timeoutSeconds: 10
    failureThreshold: 5
    periodSeconds: 60
  # Airflow 2.0 allows users to run multiple schedulers,
  # However this feature is only recommended for MySQL 8+ and Postgres
  replicas: 1

gitussue에서 다른 사람이 사용하는 예시

# Airflow scheduler settings
scheduler:
  # If the scheduler stops heartbeating for 5 minutes (5*60s) kill the
  # scheduler and let Kubernetes restart it
  livenessProbe:
    initialDelaySeconds: 10
    timeoutSeconds: 180
    failureThreshold: 20
    periodSeconds: 60
  # Airflow 2.0 allows users to run multiple schedulers,
  # However this feature is only recommended for MySQL 8+ and Postgres
  replicas: 2

 

참고
https://www.astronomer.io/blog/airflow-2-scheduler
https://medium.com/qonto-way/scaling-airflow-on-kubernetes-lessons-learned-a0d3d0417fc1

 

Scaling Airflow on Kubernetes: lessons learned

Moving from an in-house ETL to Kubernetes and Airflow

medium.com

 

https://github.com/apache/airflow/issues/19001

728x90
반응형