版本信息:
python 2.7.15
airflow==1.8.0
SQLAlchemy==1.1.18
flower==0.9.2
其中SQLAlchemy的版本如果是1.2.x版本会在创建用户是报错,
[root@localhost ~]# python2 create_user.py
[2018-07-18 18:51:09,336] {__init__.py:57} INFO - Using executor CeleryExecutor
Traceback (most recent call last):
File "create_user.py", line 7, in <module>
user.password = 'afuser'
File "/soft/anaconda2/lib/python2.7/site-packages/sqlalchemy/ext/hybrid.py", line 873, in __set__
raise AttributeError("can't set attribute")
AttributeError: can't set attribute
使用pip安装airflow,celery,此外
- 需要使用rabbitmq作为celery的backend需要pip install airflow[rabbitmq]
- 需要登录认证时pip install airflow[password]
- 需要使用CeleryExecutor时install apache-airflow[celery]
说明文档参考Extra Packages
airflow默认使用sqlite作为Airflow后台数据库,这里我改成mysql:
首先pip install airflow[mysql]
这里先设置airflow的环境变量AIRFLOW_HOME,
vim /etc/profile
加入export AIRFLOW_HOME=/home/crawl/airflow
然后执行
source /etc/profile
使生效
否则airflow会在当前用户的家目录下生成airflow文件夹
然后执行airflow,就会在$AIRFLOW_HOME下生成