Airflow - 安装 Airflow2.4.3 作者:马育民 • 2023-04-09 17:31 • 阅读:10191 # 启动环境 启动名字是 airflow 的python环境: ``` [root@hadoop3 ~]# conda activate airflow ``` ### 安装 numpy airflow需要用到numpy ``` (airflow) [root@hadoop3 ~]# pip install numpy ``` 或 ``` (airflow) [root@hadoop3 ~]# pip install numpy -i https://pypi.tuna.tsinghua.edu.cn/simple ``` ### 安装 airflow ``` (airflow) [root@hadoop3 ~]# pip install "apache-airflow==2.4.3" ``` 或 ``` (airflow) [root@hadoop3 ~]# pip install "apache-airflow==2.4.3" -i https://pypi.tuna.tsinghua.edu.cn/simple ``` # 初始化数据库 ``` (airflow) [root@hadoop3 ~]# airflow db init ``` 看到下面提示信息,说明初始化完成: ``` Initialization done ``` # 创建用户 ``` (airflow) [root@hadoop3 ~]# airflow users create \ --username admin \ --firstname admin \ --lastname admin \ --role Admin \ --email 65242847@qq.com ``` 提示输入密码,如下: ``` Password: ``` 输入密码:`admin`,敲回车 提示确认输入密码,如下: ``` Repeat for confirmation: ``` 输入密码:`admin`,敲回车 提示下面信息,说明成功: ``` [2023-04-09 19:00:24,510] {manager.py:212} INFO - Added user admin User "admin" created with role "Admin" ``` # 启动 web 服务 方便查看、管理任务 ``` (airflow) [root@hadoop3 ~]# airflow webserver -p 8080 -D ``` **解释:** `-D`:后台启动 ### 访问web网页 http://hadoop3:8080 显示登录页面,需要输入用户名 `admim`、密码 `admim` # 启动调度服务 该服务负责执行任务 ``` (airflow) [root@hadoop3 ~]# airflow scheduler -D ``` 提示下图说明启动成功: ``` ____________ _____________ ____ |__( )_________ __/__ /________ __ ____ /| |_ /__ ___/_ /_ __ /_ __ \_ | /| / / ___ ___ | / _ / _ __/ _ / / /_/ /_ |/ |/ / _/_/ |_/_/ /_/ /_/ /_/ \____/____/|__/ ``` 原文出处:http://malaoshi.top/show_1IX5Ht8gFy5R.html