반응형
이 글에서는 Airflow를 Docker에서 설정하고, 여러 서버 간 로그를 공유하는 방법에 대해 다뤄본다. 특히, 1번 서버(마스터 + 워커)가 2번 서버(워커)의 로그를 참조할 수 있도록 NFS(네트워크 파일 시스템)를 사용하여 로그를 공유하는 설정 방법을 설명한다.
Airflow를 1번 서버(마스터 + 워커)와 2번 서버(워커)로 구성할 때의 작업 흐름
1. 구성 요소 설명
- 1번 서버 (마스터 + 워커):
- 마스터: Airflow 웹 서버와 스케줄러를 포함한다. 웹 서버는 UI를 제공하며, 스케줄러는 DAG(Directed Acyclic Graph)를 관리하고 태스크를 트리거한다.
- 워커: Celery 워커가 포함되어 태스크를 실행한다.
- 데이터베이스: Airflow 메타데이터 데이터베이스(PostgreSQL)를 호스팅하며, 작업 상태, DAG 정보 등을 저장한다.
- 브로커: Redis를 사용하여 태스크 큐를 관리한다.
- 2번 서버 (워커):
- 워커: Celery 워커만 포함되어 태스크를 실행한다.
2. 작업 흐름
- DAG 정의 및 등록:
- 사용자가 DAG를 정의하면, DAG 파일은 1번 서버의 지정된 DAG 폴더에 배치된다.
- 스케줄러가 주기적으로 이 폴더를 스캔하여 새로운 DAG를 감지하고, 이를 메타데이터 데이터베이스에 등록한다.
- 스케줄러 작업:
- 1번 서버의 스케줄러가 DAG 스케줄에 따라 태스크를 큐에 넣는다.
- 스케줄러는 태스크가 언제 실행되어야 하는지 결정하고, Redis 브로커에 태스크를 큐잉한다.
- 태스크 분배:
- Redis 브로커는 큐에 있는 태스크를 워커에게 전달한다. 워커는 1번 서버와 2번 서버에 분산되어 있다.
- 워커는 태스크를 받아 실행한다. 이때 태스크의 종류와 실행 가능 여부에 따라 적절한 워커가 태스크를 처리하게 된다.
- 태스크 실행:
- 워커는 DAG 정의에 따라 태스크를 실행하고, 결과를 데이터베이스에 기록한다.
- 만약 태스크 실행 중 문제가 발생하면, 해당 정보도 데이터베이스에 기록된다.
- 모니터링 및 관리:
- 사용자는 1번 서버의 웹 서버를 통해 DAG와 태스크의 상태를 모니터링하고 관리할 수 있다.
- 웹 UI를 통해 DAG 실행 상태, 로그, 결과 등을 확인할 수 있다.
3. 장점
- 분산 처리: 태스크를 여러 워커에 분산하여 처리하므로, 작업 병목이 줄어든다.
- 확장성: 2번 서버에 추가 워커를 배치하여 태스크 처리 능력을 확장할 수 있다.
- 중앙 관리: 모든 작업은 1번 서버의 웹 서버와 스케줄러를 통해 중앙에서 관리되므로, 모니터링과 관리가 용이하다.
이 구성은 Airflow 클러스터의 확장성과 성능을 높이는 데 유용하며, 다양한 작업을 효율적으로 처리할 수 있게 한다.
Docker에서 Airflow 설정
1번 서버(마스터) 설정
1번 서버에서 PostgreSQL, Redis, 그리고 Airflow 웹서버와 Flower를 설정한다. 또한, docker-compose.yml 파일에서 로그 디렉토리를 공유할 NFS 디렉토리로 설정한다.
version: '3'
x-airflow-common:
&airflow-common
# In order to add custom dependencies or upgrade provider packages you can use your extended image.
# Comment the image line, place your Dockerfile in the directory where you placed the docker-compose.yaml
# and uncomment the "build" line below, Then run `docker-compose build` to build the images.
image: ${AIRFLOW_IMAGE_NAME:-apache/airflow:2.3.3}
# build: .
environment:
&airflow-environment
AIRFLOW__CORE__EXECUTOR: CeleryExecutor
AIRFLOW__CORE__SQL_ALCHEMY_CONN: postgresql+psycopg2://airflow:airflow@postgres/airflow
AIRFLOW__CELERY__BROKER_URL: redis://redis:6379/0
AIRFLOW__CELERY__RESULT_BACKEND: db+postgresql://airflow:airflow@postgres/airflow
AIRFLOW__CORE__FERNET_KEY: "YOUR_FERNET_KEY"
AIRFLOW__CORE__DAGS_ARE_PAUSED_AT_CREATION: "true"
AIRFLOW__CORE__LOAD_EXAMPLES: "false"
_PIP_ADDITIONAL_REQUIREMENTS: ""
#### 추가 ####
AIRFLOW__CORE__DAGS_FOLDER: /app/airflow/dags
AIRFLOW__CORE__BASE_LOG_FOLDER: /app/airflow/logs
AIRFLOW__CORE__DAG_PROCESSOR_MANAGER_LOG_LOCATION: /app/airflow/logs/dag_processor_manager.log
AIRFLOW__LOGGING__LOGGING_LEVEL: INFO # 로그 레벨
MY_ENVRIMENT: "dev" # 컨테이너 내부의 /etc/enviroment에 적용할 환경 변수
extra_hosts:
- server_host_name:ip # 컨테이너 내부의 /etc/hosts에 등록할 ip 추가
working_dir: /app # 에어플로우 기본 작업 디렉토리 설정. 미 설정 시 기본 값은 opt
#### 추가 ####
volumes:
- /nfs/airflow/logs:/app/airflow/logs # 컨테이너의 로그 디렉토리와 NFS 디렉토리 마운트
- app/airflow/dags:/app/airflow/dags
- app/airflow/plugins:/app/airflow/plugins
user: "${AIRFLOW_UID:-50000}:0"
기본 airflow docker-compose.yaml에 추가한 항목 설명
- AIRFLOW__CORE__DAGS_FOLDER: 이 변수는 Airflow가 컨테이너 내부의 DAG(Directed Acyclic Graph) 파일을 찾는 기본 디렉토리 경로를 설정한다. Airflow는 이 디렉토리에서 DAG 파일을 로드하고 스케줄링한다. DAG 파일의 업데이트가 이 디렉토리에서 감지된다.
- AIRFLOW__CORE__BASE_LOG_FOLDER: 이 변수는 컨테이너 내부의 Airflow 작업 실행 로그를 저장하는 기본 디렉토리 경로를 설정한다. Airflow의 각 작업(task)이 실행될 때마다 로그 파일이 이 디렉토리에 생성된다.
- AIRFLOW__CORE__DAG_PROCESSOR_MANAGER_LOG_LOCATION: 이 변수는 컨테이너 내부의 DAG 프로세서 관리자(DAG Processor Manager)의 로그 파일 위치를 설정한다. DAG 프로세서 관리자는 DAG 파일을 읽고 구문 분석하는 역할을 하며, 이 로그 파일은 DAG 파일의 구문 분석 과정에서 발생하는 이벤트 및 오류를 기록한다. DAG 파일이 올바르게 로드되었는지, 오류가 발생했는지 등의 정보를 제공한다.
- MY_ENVRIMENT: "dev" : 컨테이너 내부의 /etc/enviroment에 적용할 환경 변수이다. dev, sit, prd 서버 구분용 환경변수를 위해 추가하였다.
- working_dir:/app: 에어플로우 기본 작업 디렉토리 설정한다. 미 설정 시 기본 값은 opt
- extra_hosts: - server_host_name:ip : 컨테이너가 실행되는 동안 호스트 파일(/etc/hosts)에 추가 항목을 추가하기 위해 사용한다.
- /nfs/airflow/logs:/app/airflow/logs: 컨테이너의 로그 디렉토리와 NFS 디렉토리 마운트한다. ":" 기준으로 왼쪽이 컨테이너 외부, 오른쪽이 컨테이너 내부 디렉토리이다. 두 대의 서버가 동일한 NFS(Network File System) 디렉토리를 사용하여 로그 데이터를 공유하기 위해 설정하였다.
2번 서버(워커) 설정
version: '3'
x-airflow-common:
&airflow-common
# In order to add custom dependencies or upgrade provider packages you can use your extended image.
# Comment the image line, place your Dockerfile in the directory where you placed the docker-compose.yaml
# and uncomment the "build" line below, Then run `docker-compose build` to build the images.
image: ${AIRFLOW_IMAGE_NAME:-apache/airflow:2.3.3}
# build: .
environment:
&airflow-environment
AIRFLOW__CORE__EXECUTOR: CeleryExecutor
AIRFLOW__CORE__SQL_ALCHEMY_CONN: postgresql+psycopg2://airflow:airflow@1번서버IP:PORT/airflow
AIRFLOW__CELERY__BROKER_URL: redis://:@1번서버IP:PORT/0
AIRFLOW__CELERY__RESULT_BACKEND: db+postgresql://airflow:airflow@1번서버IP:PORT/airflow
AIRFLOW__CORE__FERNET_KEY: "YOUR_FERNET_KEY"
AIRFLOW__CORE__DAGS_ARE_PAUSED_AT_CREATION: "true"
AIRFLOW__CORE__LOAD_EXAMPLES: "false"
_PIP_ADDITIONAL_REQUIREMENTS: ""
#### 추가 ####
AIRFLOW__CORE__DAGS_FOLDER: /app/airflow/dags
AIRFLOW__CORE__BASE_LOG_FOLDER: /app/airflow/logs
AIRFLOW__CORE__DAG_PROCESSOR_MANAGER_LOG_LOCATION: /app/airflow/logs/dag_processor_manager.log
AIRFLOW__LOGGING__LOGGING_LEVEL: INFO # 로그 레벨
MY_ENVRIMENT: "dev" # 컨테이너 내부의 /etc/enviroment에 적용할 환경 변수
extra_hosts:
- server_host_name:ip # 컨테이너 내부의 /etc/hosts에 등록할 ip 추가
working_dir: /app # 에어플로우 기본 작업 디렉토리 설정. 미 설정 시 기본 값은 opt
#### 추가 ####
volumes:
- /NFS/airflow/logs:/app/airflow/logs # 컨테이너의 로그 디렉토리와 NFS 디렉토리 마운트
- app/airflow/dags:/app/airflow/dags
- app/airflow/plugins:/app/airflow/plugins
user: "${AIRFLOW_UID:-50000}:0"
1번 서버와 동일하지만 몇가지 차이점이 있다.
- AIRFLOW__CORE__SQL_ALCHEMY_CONN: postgresql+psycopg2://airflow:airflow@1번서버IP:PORT/airflow
- AIRFLOW__CELERY__RESULT_BACKEND: db+postgresql://airflow:airflow@1번서버IP:PORT/airflow
위 두가지 설정은 1번 서버와 다르게 끝에 postgres/airflow가 아닌 airflow만 지정한다. 그 이유는 1번 서버의 설정은 postgres db의 airflow 스키마 명을 설정한 것이고 2번 서버는 1번 서버의 ip와 port를 참조하기 때문에 1번 서버의 airflow 라는 스키마 명만 지정한다.
1번 서버 docker-compose.yaml 파일 전체
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
# Basic Airflow cluster configuration for CeleryExecutor with Redis and PostgreSQL.
#
# WARNING: This configuration is for local development. Do not use it in a production deployment.
#
# This configuration supports basic configuration using environment variables or an .env file
# The following variables are supported:
#
# AIRFLOW_IMAGE_NAME - Docker image name used to run Airflow.
# Default: apache/airflow:2.3.3
# AIRFLOW_UID - User ID in Airflow containers
# Default: 50000
# Those configurations are useful mostly in case of standalone testing/running Airflow in test/try-out mode
#
# _AIRFLOW_WWW_USER_USERNAME - Username for the administrator account (if requested).
# Default: airflow
# _AIRFLOW_WWW_USER_PASSWORD - Password for the administrator account (if requested).
# Default: airflow
# _PIP_ADDITIONAL_REQUIREMENTS - Additional PIP requirements to add when starting all containers.
# Default: ''
#
# Feel free to modify this file to suit your needs.
---
version: '3'
x-airflow-common:
&airflow-common
# In order to add custom dependencies or upgrade provider packages you can use your extended image.
# Comment the image line, place your Dockerfile in the directory where you placed the docker-compose.yaml
# and uncomment the "build" line below, Then run `docker-compose build` to build the images.
image: ${AIRFLOW_IMAGE_NAME:-apache/airflow:2.3.3}
# build: .
environment:
AIRFLOW__CORE__EXECUTOR: CeleryExecutor
AIRFLOW__CORE__SQL_ALCHEMY_CONN: postgresql+psycopg2://airflow:airflow@postgres/airflow
AIRFLOW__CELERY__BROKER_URL: redis://redis:6379/0
AIRFLOW__CELERY__RESULT_BACKEND: db+postgresql://airflow:airflow@postgres/airflow
AIRFLOW__CORE__FERNET_KEY: "YOUR_FERNET_KEY"
AIRFLOW__CORE__DAGS_ARE_PAUSED_AT_CREATION: "true"
AIRFLOW__CORE__LOAD_EXAMPLES: "false"
_PIP_ADDITIONAL_REQUIREMENTS: ""
AIRFLOW__CORE__DAGS_FOLDER: /app/airflow/dags
AIRFLOW__CORE__BASE_LOG_FOLDER: /app/airflow/logs
AIRFLOW__CORE__DAG_PROCESSOR_MANAGER_LOG_LOCATION: /app/airflow/logs/dag_processor_manager.log
AIRFLOW__LOGGING__LOGGING_LEVEL: INFO
MY_ENVRIMENT: "dev"
extra_hosts:
- server_host_name:ip
working_dir: /app
volumes:
- /nfs/airflow/logs:/app/airflow/logs
- app/airflow/dags:/app/airflow/dags
- app/airflow/plugins:/app/airflow/plugins
user: "${AIRFLOW_UID:-50000}:0"
depends_on:
&airflow-common-depends-on
redis:
condition: service_healthy
postgres:
condition: service_healthy
services:
postgres:
image: postgres:13
environment:
POSTGRES_USER: airflow
POSTGRES_PASSWORD: airflow
POSTGRES_DB: airflow
volumes:
- postgres-db-volume:/var/lib/postgresql/data
healthcheck:
test: ["CMD", "pg_isready", "-U", "airflow"]
interval: 5s
retries: 5
restart: always
redis:
image: redis:latest
expose:
- 6379
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 30s
retries: 50
restart: always
airflow-webserver:
<<: *airflow-common
command: webserver
ports:
- 8080:8080
healthcheck:
test: ["CMD", "curl", "--fail", "http://localhost:8080/health"]
interval: 10s
timeout: 10s
retries: 5
restart: always
depends_on:
<<: *airflow-common-depends-on
airflow-init:
condition: service_completed_successfully
airflow-scheduler:
<<: *airflow-common
command: scheduler
healthcheck:
test: ["CMD-SHELL", 'airflow jobs check --job-type SchedulerJob --hostname "$${HOSTNAME}"']
interval: 10s
timeout: 10s
retries: 5
restart: always
depends_on:
<<: *airflow-common-depends-on
airflow-init:
condition: service_completed_successfully
airflow-worker:
<<: *airflow-common
command: celery worker
healthcheck:
test:
- "CMD-SHELL"
- 'celery --app airflow.executors.celery_executor.app inspect ping -d "celery@$${HOSTNAME}"'
interval: 10s
timeout: 10s
retries: 5
environment:
<<: *airflow-common-env
# Required to handle warm shutdown of the celery workers properly
# See https://airflow.apache.org/docs/docker-stack/entrypoint.html#signal-propagation
DUMB_INIT_SETSID: "0"
restart: always
depends_on:
<<: *airflow-common-depends-on
airflow-init:
condition: service_completed_successfully
airflow-triggerer:
<<: *airflow-common
command: triggerer
healthcheck:
test: ["CMD-SHELL", 'airflow jobs check --job-type TriggererJob --hostname "$${HOSTNAME}"']
interval: 10s
timeout: 10s
retries: 5
restart: always
depends_on:
<<: *airflow-common-depends-on
airflow-init:
condition: service_completed_successfully
airflow-init:
<<: *airflow-common
entrypoint: /bin/bash
# yamllint disable rule:line-length
command:
- -c
- |
function ver() {
printf "%04d%04d%04d%04d" $${1//./ }
}
airflow_version=$$(AIRFLOW__LOGGING__LOGGING_LEVEL=INFO && gosu airflow airflow version)
airflow_version_comparable=$$(ver $${airflow_version})
min_airflow_version=2.2.0
min_airflow_version_comparable=$$(ver $${min_airflow_version})
if (( airflow_version_comparable < min_airflow_version_comparable )); then
echo
echo -e "\033[1;31mERROR!!!: Too old Airflow version $${airflow_version}!\e[0m"
echo "The minimum Airflow version supported: $${min_airflow_version}. Only use this or higher!"
echo
exit 1
fi
if [[ -z "${AIRFLOW_UID}" ]]; then
echo
echo -e "\033[1;33mWARNING!!!: AIRFLOW_UID not set!\e[0m"
echo "If you are on Linux, you SHOULD follow the instructions below to set "
echo "AIRFLOW_UID environment variable, otherwise files will be owned by root."
echo "For other operating systems you can get rid of the warning with manually created .env file:"
echo " See: https://airflow.apache.org/docs/apache-airflow/stable/start/docker.html#setting-the-right-airflow-user"
echo
fi
one_meg=1048576
mem_available=$$(($$(getconf _PHYS_PAGES) * $$(getconf PAGE_SIZE) / one_meg))
cpus_available=$$(grep -cE 'cpu[0-9]+' /proc/stat)
disk_available=$$(df / | tail -1 | awk '{print $$4}')
warning_resources="false"
if (( mem_available < 4000 )) ; then
echo
echo -e "\033[1;33mWARNING!!!: Not enough memory available for Docker.\e[0m"
echo "At least 4GB of memory required. You have $$(numfmt --to iec $$((mem_available * one_meg)))"
echo
warning_resources="true"
fi
if (( cpus_available < 2 )); then
echo
echo -e "\033[1;33mWARNING!!!: Not enough CPUS available for Docker.\e[0m"
echo "At least 2 CPUs recommended. You have $${cpus_available}"
echo
warning_resources="true"
fi
if (( disk_available < one_meg * 10 )); then
echo
echo -e "\033[1;33mWARNING!!!: Not enough Disk space available for Docker.\e[0m"
echo "At least 10 GBs recommended. You have $$(numfmt --to iec $$((disk_available * 1024 )))"
echo
warning_resources="true"
fi
if [[ $${warning_resources} == "true" ]]; then
echo
echo -e "\033[1;33mWARNING!!!: You have not enough resources to run Airflow (see above)!\e[0m"
echo "Please follow the instructions to increase amount of resources available:"
echo " https://airflow.apache.org/docs/apache-airflow/stable/start/docker.html#before-you-begin"
echo
fi
mkdir -p /sources/logs /sources/dags /sources/plugins
chown -R "${AIRFLOW_UID}:0" /sources/{logs,dags,plugins}
exec /entrypoint airflow version
# yamllint enable rule:line-length
environment:
<<: *airflow-common-env
_AIRFLOW_DB_UPGRADE: 'true'
_AIRFLOW_WWW_USER_CREATE: 'true'
_AIRFLOW_WWW_USER_USERNAME: ${_AIRFLOW_WWW_USER_USERNAME:-airflow}
_AIRFLOW_WWW_USER_PASSWORD: ${_AIRFLOW_WWW_USER_PASSWORD:-airflow}
_PIP_ADDITIONAL_REQUIREMENTS: ''
user: "0:0"
volumes:
- .:/sources
airflow-cli:
<<: *airflow-common
profiles:
- debug
environment:
<<: *airflow-common-env
CONNECTION_CHECK_MAX_COUNT: "0"
# Workaround for entrypoint issue. See: https://github.com/apache/airflow/issues/16252
command:
- bash
- -c
- airflow
# You can enable flower by adding "--profile flower" option e.g. docker-compose --profile flower up
# or by explicitly targeted on the command line e.g. docker-compose up flower.
# See: https://docs.docker.com/compose/profiles/
flower:
<<: *airflow-common
command: celery flower
profiles:
- flower
ports:
- 5555:5555
healthcheck:
test: ["CMD", "curl", "--fail", "http://localhost:5555/"]
interval: 10s
timeout: 10s
retries: 5
restart: always
depends_on:
<<: *airflow-common-depends-on
airflow-init:
condition: service_completed_successfully
volumes:
postgres-db-volume:
2번 서버 docker-compose.yaml 파일 전체
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
# Basic Airflow cluster configuration for CeleryExecutor with Redis and PostgreSQL.
#
# WARNING: This configuration is for local development. Do not use it in a production deployment.
#
# This configuration supports basic configuration using environment variables or an .env file
# The following variables are supported:
#
# AIRFLOW_IMAGE_NAME - Docker image name used to run Airflow.
# Default: apache/airflow:2.3.3
# AIRFLOW_UID - User ID in Airflow containers
# Default: 50000
# Those configurations are useful mostly in case of standalone testing/running Airflow in test/try-out mode
#
# _AIRFLOW_WWW_USER_USERNAME - Username for the administrator account (if requested).
# Default: airflow
# _AIRFLOW_WWW_USER_PASSWORD - Password for the administrator account (if requested).
# Default: airflow
# _PIP_ADDITIONAL_REQUIREMENTS - Additional PIP requirements to add when starting all containers.
# Default: ''
#
# Feel free to modify this file to suit your needs.
---
version: '3'
x-airflow-common:
&airflow-common
# In order to add custom dependencies or upgrade provider packages you can use your extended image.
# Comment the image line, place your Dockerfile in the directory where you placed the docker-compose.yaml
# and uncomment the "build" line below, Then run `docker-compose build` to build the images.
image: ${AIRFLOW_IMAGE_NAME:-apache/airflow:2.3.3}
# build: .
environment:
AIRFLOW__CORE__EXECUTOR: CeleryExecutor
AIRFLOW__CORE__SQL_ALCHEMY_CONN: postgresql+psycopg2://airflow:airflow@postgres/airflow
AIRFLOW__CELERY__BROKER_URL: redis://redis:6379/0
AIRFLOW__CELERY__RESULT_BACKEND: db+postgresql://airflow:airflow@postgres/airflow
AIRFLOW__CORE__FERNET_KEY: "YOUR_FERNET_KEY"
AIRFLOW__CORE__DAGS_ARE_PAUSED_AT_CREATION: "true"
AIRFLOW__CORE__LOAD_EXAMPLES: "false"
_PIP_ADDITIONAL_REQUIREMENTS: ""
AIRFLOW__CORE__DAGS_FOLDER: /app/airflow/dags
AIRFLOW__CORE__BASE_LOG_FOLDER: /app/airflow/logs
AIRFLOW__CORE__DAG_PROCESSOR_MANAGER_LOG_LOCATION: /app/airflow/logs/dag_processor_manager.log
AIRFLOW__LOGGING__LOGGING_LEVEL: INFO
MY_ENVRIMENT: "dev"
extra_hosts:
- server_host_name:ip
working_dir: /app
volumes:
- /nfs/airflow/logs:/app/airflow/logs
- app/airflow/dags:/app/airflow/dags
- app/airflow/plugins:/app/airflow/plugins
user: "${AIRFLOW_UID:-50000}:0"
services:
airflow-worker:
<<: *airflow-common
command: celery worker
airflow-cli:
<<: *airflow-common
profiles:
- debug
environment:
<<: *airflow-common-env
CONNECTION_CHECK_MAX_COUNT: "0"
# Workaround for entrypoint issue. See: https://github.com/apache/airflow/issues/16252
command:
- bash
- -c
- airflow
2번 서버는 워커만 사용되기 때문에 airflow-worker를 제외한 나머지 부분을 삭제하였다.
# 1번 서버 컨테이너 기동
docker-compose up -d airflow-init
docker-compose up -d
# 2번 서버 컨테이너 기동 (airflow-worker 2개 생성)
docker-compose up --scale airflow-worker=2 -d
반응형
'Airflow' 카테고리의 다른 글
Airflow PostgreSQL 최대 커넥션 개수 docker-compose.yaml 파일 설정 (2) | 2024.11.17 |
---|---|
Airflow에서 실행 중인 DAG의 코드 수정과 서버 재 시작 시 DAG 영향 (1) | 2024.11.16 |
Airflow 로그와 DAG 설정: 환경 변수 사용 예시 (0) | 2024.07.13 |
파이썬 스크립트 실행을 위한 Airflow DAG 설정하기 (0) | 2024.04.12 |
Airflow 에어플로우 Docker 컨테이너화 (1) | 2024.02.24 |