文档指定了集成说明
我想要的是,每次调度程序停止工作时,它都会由它自己重新启动。 通常我用airflow scheduler -D
手动启动它,但有时当我没空时它会停止。
阅读文档,我不确定配置。
GitHub 包含以下文件:
airflow
airflow-scheduler.service
airflow.conf
我正在运行 Ubuntu 16.04
气流安装在:
home/ubuntu/airflow
我有路径:
etc/systemd
文档说:
将它们复制(或链接(到/usr/lib/systemd/system
- 复制哪些文件?
将 airflow.conf 复制到/etc/tmpfiles.d/
什么是 tmpfiles.d ?
气流文件中
# AIRFLOW_CONFIG=
什么?
或者换句话说...关于如何做到这一点的更"脚踏实地"的指南?
将 Airflow 与 systemd 文件集成可以轻松监视您的守护进程,因为 systemd 可以负责在失败时重新启动守护进程。这还可以在系统启动时自动启动气流网络服务器和调度程序。
根据当前配置编辑Airflow Github中systemd
文件夹中的airflow
文件,以设置AIRFLOW_CONFIG
,AIRFLOW_HOME
和SCHEDULER
的环境变量。
将服务文件(扩展名为.service
的文件(复制到 VM 中的/usr/lib/systemd/system
。
将airflow.conf
文件复制到/etc/tmpfiles.d/或/usr/lib/tmpfiles.d/。复制airflow.conf
可确保使用正确的所有者和权限(0755 airflow airflow
(创建/run/airflow
。检查/run/airflow
是否存在于气流用户和气流组拥有airflow:airflow
,如果它没有创建具有这些权限/run/airflow
文件夹。
通过在命令行上发出systemctl enable <service>
来启用此服务,如下所示。
sudo systemctl enable airflow-webserver
sudo systemctl enable airflow-scheduler
airflow-scheduler.service
文件应如下所示:
[Unit]
Description=Airflow scheduler daemon
After=network.target postgresql.service mysql.service redis.service rabbitmq-server.service
Wants=postgresql.service mysql.service redis.service rabbitmq-server.service
[Service]
EnvironmentFile=/etc/sysconfig/airflow
User=airflow
Group=airflow
Type=simple
ExecStart=/bin/airflow scheduler
Restart=always
RestartSec=5s
[Install]
WantedBy=multi-user.target
你的问题有点过时,但我刚刚发现它,因为我现在对同一主题感兴趣。我想你的问题的答案就在这里。
https://medium.com/@shahbaz.ali03/run-apache-airflow-as-a-service-on-ubuntu-18-04-server-b637c03f4722