进入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
还有一些比较重要的设置,都是参考上面所贴的知乎的博客