Airflow 安装教程

说明:

 Airflow 的安装需要依赖 Python3.0 及以上版本,Python3.0的安装教程见:(https://blog.csdn.net/CZ_yjsy_data/article/details/100776239

在线安装步骤:

安装最新稳定版本的Airflow最简单的方法是使用pip:

一:airflow needs a home, ~/airflow is the default ,but you can lay foundation somewhere else if you prefer
export AIRFLOW_HOME=~/airflow
二:install from pypi using pip
pip3 install apache-airflow
三:initialize the database
airflow initdb
四:start the web server, default port is 8080 
airflow webserver -p 8080
五:start the scheduler
airflow scheduler

visit localhost:8080 in the browser and enable the example dag in the home page

pip3 install apache-airflow 执行完如下所示:

根据自己的需求安装Airflow 额外功能,如gcp或postgres:

执行: pip3 install apache-airflow[postgres,gcp]

若想安装所有的额外包,执行:

pip install apache-airflow[all]

执行完上述步骤后即可访问页面,如下图:

这里安装完成所用的数据库为:SQLite, 官网建议使用 MySQL or Postgres

 

这里我们介绍如何使用MySQL 数据库

在MySQL 中创建 AIRFLOW 的数据库,并赋予 airflowdb 用户访问该数据库的权限:

create database airflowdb;
grant all PRIVILEGES on airflowdb.* to airflow@'localhost'  identified by 'pwd';

cd 到 $AIRFLOW_HOME 目录下,

vim airflow.cfg, 修改如图的地方

在 my.cnf 文件后面追加: explicit_defaults_for_timestamp = 1

sudo vim /etc/my.cnf

重启MySQL 服务:systemctl restart mysqld

参考:https://airflow.readthedocs.io/en/stable/faq.html#how-to-fix-exception-global-variable-explicit-defaults-for-timestamp-needs-to-be-on-1

重新初始化 airflow 数据库

airflow initdb

airflow webserver -p 8080

airflow scheduler

启动完成即可访问页面

 

参考:http://airflow.apache.org/installation.html

 

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值