airflow安装跳坑

python3

 

$ sudo /cluster/software/python-3.7.0/bin/pip3 install apache-airflow[all]  
报错: Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-kdrobbz6/apache-airflow/
解决:$ sudo /cluster/software/python-3.7.0/bin/pip3 install --upgrade setuptools   失败 

大坑

====================================

python2

$ /cluster/software/python-2.7.14/lib/python2.7/site-packages/airflow/bin/airflow webserver -p 8080 
报错:Error: 'python:airflow.www.gunicorn_config' doesn't exist
解决: 前面加sudo执行。 参考:https://stackoverflow.com/questions/48017804/web-server-of-airflow-is-not-running

Airflow安装方法如下: ### 安装前准备 为了后期安装其它软件的需要,先安装必要的依赖包: ```bash yum -y groupinstall "Development tools" yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel xz-devel libffi-devel ``` ### 创建Python环境 可以使用Miniconda创建Python 3.8的虚拟环境: ```bash conda create --name airflow python=3.8 conda activate airflow ``` ### 设置Airflow目录 设置环境变量指定Airflow的主目录,因为airflow的`configuration.py`中需要这个环境变量来确定生成的配置文件、日志、dags等文件的存储位置。指定后,以后通过修改`~/airflow/airflow.cfg`文件就可以修改Airflow的配置: ```bash export AIRFLOW_HOME=~/airflow ``` 也可以通过修改`/etc/profile`文件来设置: ```bash vim /etc/profile # 在末尾添加一行配置 export AIRFLOW_HOME=/root/airflow # 使配置生效 source /etc/profile # 查看配置是否生效 echo $AIRFLOW_HOME ``` ### 安装Airflow 使用pip安装Airflow,尽可能指定版本,避免随机安装版本带来的问题,推荐使用Python 3.8配合最新的`apache-airflow==2.7.3`: ```bash pip install apache-airflow[celery]==2.7.3 ``` ### 初始化Airflow 执行此步后,会在`AIRFLOW_HOME`目录底下生成`airflow.cfg`配置文件: ```bash airflow db init ``` ### 查看版本 ```bash airflow version ``` ### 启动Airflow服务 ```bash # 启动web服务,默认端口是8080 airflow webserver -p 8080 # 启动调度器 airflow scheduler ``` 之后可以访问`localhost:8080`,并在主页启用示例DAG。 ### 安装后的细节问题 Airflow默认使用的是sqlite作为数据库,若系统默认的版本过低(`< 3.15.0`),使用`airflow`命令可能会报错`airflow.exceptions.AirflowConfigException: error: sqlite C library version too old (< 3.15.0)`,一般建议更改为MySQL,步骤如下: 1. 修改数据库为MySQL。 2. 登录MySQL,并进行Airflow数据库的相关配置。 3. 进行Airflow的相关配置。 4. 重新初始化Airflow,启动相关服务。 5. 重新创建账号登录。 6. 启动Airflow,并打开查看 [^1][^5]。
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值