离线安装airflow

 

下载airflow及其依赖

pip download -d /root/tmp  apache-airflow

pip install --no-index --find-links=/root/tmp     apache_airflow-2.1.0-py3-none-any.whl

 

 

下载python mysql连接组件

pip download -d /root/connector/  mysql-connector-python

pip install --no-index --find-links=/root/connector    mysql_connector_python-8.0.25-cp36-cp36m-manylinux1_x86_64.whl

 

#创建数据库

create user 'airflow'@'localhost' identified by 'Pas5W@rd';

grant all privileges on airflow.* to 'airflow'@'localhost';

flush privileges;

set explicit_defaults_for_timestamp = 1;

 

 

#cd 到要安装的目录如/app/airflow设置airflow_home变量,然后初始化数据库.

#这样airflow的目录不会跑到/root/airflow下面

export  AIRFLOW_HOME="$(pwd)"

airflow db init

 

 

 

vim airflow.cfg 将数据库由sqlite 改为mysql

 

 

#启动

airflow webserver &

airflow scheduler &

 

 

#创建用户

airflow users create \
--email admin@abc.com \
--firstname sam \
--lastname wang \
--username admin
--password Pas5W@rd \
--role Admin

 

 

打开浏览器访问

 

 

 

参考链接:

https://zhuanlan.zhihu.com/p/36043468

https://www.cnblogs.com/lyhtbc/p/airflow-spark-schedule.html

https://stackoverflow.com/questions/53024891/modulenotfounderror-no-module-named-mysqldb

https://stackoverflow.com/questions/59777432/how-change-the-home-folder-of-an-installation-using-enviromental-variables

posted @ 2021-06-18 10:12  sam_wang10  阅读(918)  评论(0编辑  收藏  举报