1. 컨테이너 종류 확인
weare@DESKTOP-BE1I4GE:~/airflow-setup$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
13c7de52342d apache/airflow:2.5.1 "/usr/bin/dumb-init …" 35 hours ago Up 19 hours (healthy) 8080/tcp airflow-setup_airflow-triggerer_1
8e40ffd79576 apache/airflow:2.5.1 "/usr/bin/dumb-init …" 35 hours ago Up 19 hours (healthy) 0.0.0.0:8080->8080/tcp, :::8080->8080/tcp airflow-setup_airflow-webserver_1
c57811bc9ba1 apache/airflow:2.5.1 "/usr/bin/dumb-init …" 35 hours ago Up 19 hours (healthy) 8080/tcp airflow-setup_airflow-worker_1
f14cc34e94be apache/airflow:2.5.1 "/usr/bin/dumb-init …" 35 hours ago Up 19 hours (healthy) 8080/tcp airflow-setup_airflow-scheduler_1
48ee152ae746 redis:latest "docker-entrypoint.s…" 4 days ago Up 19 hours (healthy) 6379/tcp airflow-setup_redis_1
a5e756836619 postgres:13 "docker-entrypoint.s…" 4 days ago Up 19 hours (healthy) 5432/tcp airflow-setup_postgres_1
2. 스케줄러 shell root 권한으로 접속
weare@DESKTOP-BE1I4GE:~/airflow-setup$ docker exec --user root -it f14cc34e94be sh
Get:1 http://deb.debian.org/debian bullseye InRelease [116 kB]
Get:2 http://deb.debian.org/debian-security bullseye-security InRelease [48.4 kB]
Get:3 http://deb.debian.org/debian bullseye-updates InRelease [44.1 kB]
Get:4 http://deb.debian.org/debian bullseye/main amd64 Packages [8062 kB]
Get:5 https://packages.microsoft.com/debian/11/prod bullseye InRelease [3649 B]
Get:6 https://packages.microsoft.com/debian/11/prod bullseye/main amd64 Packages [131 kB]
Get:7 http://deb.debian.org/debian-security bullseye-security/main amd64 Packages [264 kB]
Get:8 http://deb.debian.org/debian bullseye-updates/main amd64 Packages [18.8 kB]
Get:9 https://packages.microsoft.com/debian/11/prod bullseye/main arm64 Packages [27.5 kB]
Get:10 https://packages.microsoft.com/debian/11/prod bullseye/main armhf Packages [24.9 kB]
Get:11 https://packages.microsoft.com/debian/11/prod bullseye/main all Packages [1214 B]
Get:12 https://apt.postgresql.org/pub/repos/apt bullseye-pgdg InRelease [123 kB]
Get:13 https://apt.postgresql.org/pub/repos/apt bullseye-pgdg/main amd64 Packages [306 kB]
Fetched 9170 kB in 5s (1760 kB/s)
Reading package lists... Done
3. MySQL을 사용하는 Apache Airflow에서 필요한 패키지 및 라이브러리를 설치.
- apt-get은 리눅스 시스템에서 패키지 관리를 위해 사용되며, update명령어는 패키지 목록을 최신으로 갱신
(airflow)sudo apt-get update - MySQL 데이터베이스와 상호 작용하는 C 언어 클라이언트 라이브러리를 개발하기 위해 필요한 헤더 파일 및 라이브러리를 포함하는 패키지인 default-libmysqlclient-dev를 설치
(airflow)sudo apt-get install -y default-libmysqlclient-dev
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package defauld-libmysqlclient-dev - gcc는 GNU Compiler Collection의 일부로, C 및 C++ 등의 프로그래밍 언어를 컴파일하는 데 사용되는 컴파일러 설치
(airflow)sudo apt-get install -y gcc
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
gcc is already the newest version (4:10.2.1-1).
0 upgraded, 0 newly installed, 0 to remove and 45 not upgraded. - Apache Airflow에서 MySQL을 사용할 수 있게 하는 공식 제공자 패키지 apache-airflow-providers-mysql를 설치. pip3는 파이썬 패키지 설치 도구이며, --ignore-installed 플래그는 이미 설치된 패키지를 무시하고 강제로 새로운 버전 설치
(airflow)sudo pip3 install --ignore-installed "apache-airflow-providers-mysql"
Collecting apache-airflow-providers-mysql
Downloading apache_airflow_providers_mysql-5.1.0-py3-none-any.whl.metadata (16 kB)
Collecting apache-airflow-providers-common-sql>=1.3.1 (from apache-airflow-providers-mysql)
Downloading apache_airflow_providers_common_sql-1.5.1-py3-none-any.whl.metadata (10 kB)
Collecting apache-airflow>=2.4.0 (from apache-airflow-providers-mysql)
'airflow(에어플로우)' 카테고리의 다른 글
airflow에서 backfill 실행 (0) | 2024.01.03 |
---|---|
[airflow 실습] mysql 테이블 redshift로 복사하기 (0) | 2024.01.03 |
airflow에서 primary key 방법2 (0) | 2024.01.03 |
backfill과 airflow (0) | 2024.01.02 |
데이터 웨어하우스에서 primary key (0) | 2024.01.02 |