版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_24505127/article/details/85541450
1、#指定airflow 的home 目录
export AIRFLOW_HOME=~/airflow
2、#使用pip 安装apache-airflow
pip install apache-airflow
3、#初始化元数据库
airflow initdb
4、#开启web server服务,并指定访问端口为8080
airflow webserver -p 8080
5、# start the scheduler
airflow scheduler
注意:
GPL依赖
默认情况下,Apache Airflow的一个依赖项是拉入GPL库('unidecode')。如果这是一个问题,您可以通过发出强制非GPL库 ,然后继续正常安装。请注意,每次升级都需要指定。另请注意,如果系统 中已存在unidecode,则仍将使用依赖关系。export SLUGIFY_USES_TEXT_UNIDECODE=yes
运行这些命令后,Airflow将创建该$AIRFLOW_HOME文件夹并打下一个“airflow.cfg”文件,其默认值可以让您快速上手。您可以$AIRFLOW_HOME/airflow.cfg在Admin->Configuration菜单中或通过菜单中的UI 检查文件。 如果由systemd启动,则Web服务器的PID文件将存储在其中$AIRFLOW_HOME/airflow-webserver.pid或中/run/airflow/webserver.pid。
开箱即用,Airflow使用sqlite数据库,由于使用此数据库后端无法进行并行化,因此您应该很快就会长大。它与SequentialExecutor只运行任务实例的顺序协同工作。虽然这是非常有限的,但它允许您快速启动和运行并浏览UI和命令行实用程序。
以下是一些将触发一些任务实例的命令。在example1运行以下命令时,您应该能够在DAG中看到作业的状态发生变化。
# run your first task instance
airflow run example_bash_operator runme_0 2015-01-01
# run a backfill over 2 days
airflow backfill example_bash_operator -s 2015-01-01 -e 2015-01-02