본문 바로가기
  • 노션에서 삽질한 내용을 정리하는 블로그
자기발전소/# Apaches

Airflow 설치 및 구성 테스트

by iamlucia 2023. 10. 26.

 

 

💡 Airflow 
: A platform to programmatically author, schedule and monitor workflows. 
워크플로우를 프로그래밍 방식으로 작성하고, 스케줄링하고 모니터하는 플랫폼입니다.
여기서 프로그래밍 방식에 쓰이는 코드는 바로 파이썬 코드입니다. 

: Uses directed acyclic graphs (DAGs) to manage workflow orchestration. Tasks and dependencies are defined in Python and then Airflow manages the scheduling and execution.
DAGs 라는 것을 통해 워크플로우 오케스트레이션을 관리합니다. DAG는 유향 비순환 그래프를 의미합니다. 

 

 

0. Requirements

Python3.8 이상 

 

1. Airflow 설치

 

 

 

sqlite3 버전 업그레이드 가이드: 

https://airflow.apache.org/docs/apache-airflow/2.3.2/howto/set-up-database.html#setting-up-a-sqlite-database

 

 export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH 

해당 설정은 터미널을 닫으면 더이상 적용되지 않기 때문에 서버를 내렸다 올리는 경우 airflow 실행이 다시 안되는 상황이 발생한다. 따라서 ~/.bashrc를 직접 수정하여 영구 적용이 필요하다. 

sqlite3 버전 업 성공!

 

 

 

설치 성공!

 

 

3. Airflow 설정

 

- airflow db 초기화 및 확인 

(airflow) [confluent@tester105 airflow]$  airflow db init 
...
Initialization done

(airflow) [confluent@tester105 airflow]$ tree -L 1
.
├── airflow.cfg
├── airflow.db
├── bin
├── include
├── lib
├── lib64 -> lib
├── logs
├── pyvenv.cfg
└── webserver_config.py

 

- airflow admin 사용자 계정 생성

(airflow) [confluent@tester105 airflow]$ airflow users create --username admin --firstname young --lastname son --role A
dmin --email {MY_MAIL_ADDRESS}

Password: {test1234}
Repeat for confirmation:
[2023-10-26 17:37:20,665] {manager.py:213} INFO - Added user admin
User "admin" created with role "Admin"

 

4. Airflow web server 실행 

실행 전 webserver listen port 를 바꾸고 싶다면 , ${AIRFLOW_HOME}/airflow.cfg 에서 아래 부분 포트 수정

 

[webserver]
# The base url of your website as airflow cannot guess what domain or
# cname you are using. This is used in automated emails that
# airflow sends to point links to the right web server
base_url = http://localhost:18080

# Default timezone to display all dates in the UI, can be UTC, system, or
# any IANA timezone string (e.g. Europe/Amsterdam). If left empty the
# default value of core/default_timezone will be used
# Example: default_ui_timezone = America/New_York
default_ui_timezone = Asia/Seoul

# The ip specified when starting the web server
web_server_host = 0.0.0.0

# The port on which to run the web server
web_server_port = 18080

+ 
endpoint_url = http://localhost:18080

 

airflow webserver 실행시 아래와 같은 에러 발생 

 

 ERROR - Add Permission to Role Error: (sqlite3.IntegrityError) FOREIGN KEY constraint failed

에러가 나도 해당 command 실행 한 채로 웹서버 포트 접근하면 가능

 

'자기발전소 > # Apaches' 카테고리의 다른 글

Install Airflow on Kubernetes  (0) 2023.11.26
[Flink] Apache Flink Pod 배포 (Kubernetes)  (1) 2023.11.03
Install Apache Airflow on Docker  (0) 2023.11.01