Airflow + MySQL

 进入MySQL数据库

mysql> create database airflow;

mysql> create user 'airflow'@'%' identified by '';
Query OK, 0 rows affected (0.00 sec)

mysql> create user 'airflow'@'localhost' identified by '';
Query OK, 0 rows affected (0.00 sec)

mysql> grant all on airflow.* to 'airflow'@'%';
Query OK, 0 rows affected (0.01 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)

这里需要说明一下,我在Airflow初探这篇博客中是把Airflow安装在/home/hadoop/airflow中,而这篇文章,我使用root用户重新安装了一次Airflow,并把Airflow安装在/root/airflow中。

[root@hadoop004 airflow]# pwd
/root/airflow

[root@hadoop004 airflow]# ls
airflow.cfg  airflow.db  airflow-webserver.pid  logs  unittests.cfg

更改相关配置

[root@hadoop004 airflow]# vim airflow.cfg

web_server_port = 8082

sql_alchemy_conn = mysql://account:pwd@localhost:3306/airflow
mysql://帐号:密码@ip:port/db

default_timezone = Asia/Shanghai

load_examples = False

min_file_process_interval = 10

修改时区(如果你是初次安装,可以先暂时不修改)

[root@hadoop004 airflow]# vim www/templates/admin/master.html

 

 

[root@hadoop004 airflow]# vim models/__init__.py

[root@hadoop004 airflow]# vim www/templates/airflow/dags.html

 

启动Airflow

[root@hadoop004 airflow]# cd /root

[root@hadoop004 airflow]# airflow initdb

解决方案

https://airflow.readthedocs.io/en/stable/faq.html

[root@hadoop004 airflow]# vim /etc/my.cnf

 

[root@hadoop004 airflow]# systemctl stop  mysqld

[root@hadoop004 airflow]# systemctl start mysqld

[root@hadoop004 airflow]# airflow initdb

查看数据库

启动

[root@hadoop004 airflow]# airflow webserver  >/dev/null 2>&1 &

由上图可以看到,时区已经变化了

成功!

另外还有一些需要注意的问题,详情请查看https://zhuanlan.zhihu.com/p/47259326

我在安装的过程中并没有设置这个环境变量

如需要用户认证

如需要邮件服务

如需设置Executor

还有一些比较重要的设置,都是参考上面所贴的知乎的博客

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值