반응형
기본 명령어 세팅 및 설치
sudo apt update
sudo apt install python3-pip
sudo apt install python3-testresources
sudo apt-get update -y
sudo apt-get install -y --no-install-recommends \
freetds-bin \
krb5-user \
ldap-utils \
libsasl2-2 \
libsasl2-modules \
libssl1.1 \
locales \
lsb-release \
sasl2-bin \
sqlite3 \
unixodbc \
postgresql \
python3-pip \
python3-testresources
airflow 폴더 생성 및 환경변수 세팅
mkdir ~/airflow
export AIRFLOW_HOME=~/airflow
export AIRFLOW_VERSION="2.3.2"
export PYTHON_VERSION="$(python3 --version | cut -d " " -f 2 | cut -d "." -f 1-2)"
export CONSTRAINT_URL="https://raw.githubusercontent.com/apache/airflow/constraints-${AIRFLOW_VERSION}/constraints-${PYTHON_VERSION}.txt"
export PATH=$PATH:/home/ubuntu/.local/bin
airflow 설치 및 계정 생성
sudo apt-get install -y postgresql-server-dev-all
sudo apt-get install -y postgresql-common
sudo pip3 install apache-airflow
sudo pip3 install apache-airflow-providers-postgres[amazon]==2.0.0
sudo pip3 install cryptography psycopg2-binary boto3 botocore
sudo pip3 install SQLAlchemy==1.3.23
airflow db init
# 사용자 생성
airflow users create \
--username admin \
--firstname Sunho \
--lastname Pyeong \
--role Admin \
--email wmfrlek99@gmail.com \
--password vudtjsgh789
# 웹 서버 시작
airflow webserver --port 8080
# 스케쥴러 시작
airflow scheduler
airflow.cfg 파일 수정
# load_example = False로 설정
# airflow db 삭제
rm - rf airflow.db
airflow db init # airflow db 초기화
postgresql 설치
기존 Executor는 하나의 dag밖에 실행을 하지 못함. 따라서 자기가 원하고자 하는 airflow dag 유형에 맞춰 executor를 바꿔야 합니다.
https://newt-tan.medium.com/apache-airflow-installation-based-on-postgresql-database-26549b154d8
Apache Airflow Installation based on Postgresql database
If you want to use the CeleryExecutor, which is one of the ways you can scale out the number of workers, you need to setup a Celery…
newt-tan.medium.com
이후 airflow.cfg 에서 LocalExecutor로 바꿔야합니다.
이후 airflow db init으로 다시 airflow를 시작합니다.
'Apache > Apache Airflow' 카테고리의 다른 글
Apache Airflow란? (1) | 2023.02.12 |
---|