117.airflow安装教程

安装

https://airflow.apache.org/docs/apache-airflow/stable/start.html

export AIRFLOW_HOME=~/airflow

sudo snap install astral-uv

AIRFLOW_VERSION=3.0.1

# Extract the version of Python you have installed. If you're currently using a Python version that is not supported by Airflow, you may want to set this manually.
# See above for supported versions.
PYTHON_VERSION="$(python -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")')"

CONSTRAINT_URL="https://raw.githubusercontent.com/apache/airflow/constraints-${AIRFLOW_VERSION}/constraints-${PYTHON_VERSION}.txt"
# For example this would install 3.0.0 with python 3.9: https://raw.githubusercontent.com/apache/airflow/constraints-3.0.1/constraints-3.9.txt

uv pip install "apache-airflow==${AIRFLOW_VERSION}" --constraint "${CONSTRAINT_URL}"


airflow db migrate

airflow users create \
    --username admin \
    --firstname Peter \
    --lastname Parker \
    --role Admin \
    --email admin@superhero.org

airflow api-server --port 8080

airflow scheduler

airflow dag-processor

airflow triggerer


airflow users create \
    --username admin \
    --firstname Peter \
    --lastname Parker \
    --role Admin \
    --email 1107847724@qq.com


# 创建Airflow中的用户,邮箱,用户名,角色是必选的选项,命令成功会要求输入两次密码,输入之后即可成功创建
   
    
airflow webserver --port 8080 #启动Airflow 服务器,启动后即可在网页中进行访问 ,加入-D选项即可后台运行
airflow scheduler #启动调度器,加入-D选项即可后台运行
posted @ 2026-01-09 11:53  cerofang  阅读(13)  评论(0)    收藏  举报