gpt4 book ai didi

amazon-ec2 - "Error:/run/airflow doesn' t 存在。将 systemd 用于 Airflow 网络服务器时可以为 't create pidfile."

转载 作者:行者123 更新时间:2023-12-03 15:56:34 27 4
gpt4 key购买 nike

我已经根据 this 将我的 Airflow 设置配置为与 systemd 一起运行.好几天了,但它抛出了一些我不知道如何修复的错误。运行 sudo systemctl start airflow-webserver.service除了运行之外什么也没做airflow webserver有效(但是,为了我们的目的需要使用 systemd)。

要了解错误是什么,我运行 sudo systemctl status airflow-webserver.service ,并给出以下状态和错误:

Feb 20 18:54:43 ip-172-31-25-17.ec2.internal airflow[19660]: [2019-02-20 18:54:43,774] {models.py:258} INFO - Filling up the DagBag from /home/ec2-user/airflow/dags
Feb 20 18:54:43 ip-172-31-25-17.ec2.internal airflow[19660]: /home/ec2-user/airflow/dags/statcan_1410009501.py:33: SyntaxWarning: name 'pg_hook' is assigned to before global declaration
Feb 20 18:54:43 ip-172-31-25-17.ec2.internal airflow[19660]: global pg_hook
Feb 20 18:54:43 ip-172-31-25-17.ec2.internal airflow[19660]: /usr/lib/python2.7/site-packages/airflow/utils/helpers.py:346: DeprecationWarning: Importing 'PythonOperator' directly from 'airflow.operators' has been deprecated. Please import from 'airflow.operators.[operat...irely in Airflow 2.0.
Feb 20 18:54:43 ip-172-31-25-17.ec2.internal airflow[19660]: DeprecationWarning)
Feb 20 18:54:43 ip-172-31-25-17.ec2.internal airflow[19660]: /usr/lib/python2.7/site-packages/airflow/utils/helpers.py:346: DeprecationWarning: Importing 'BashOperator' directly from 'airflow.operators' has been deprecated. Please import from 'airflow.operators.[operator...irely in Airflow 2.0.
Feb 20 18:54:43 ip-172-31-25-17.ec2.internal airflow[19660]: DeprecationWarning)
Feb 20 18:54:44 ip-172-31-25-17.ec2.internal airflow[19660]: [2019-02-20 18:54:44,528] {settings.py:174} INFO - setting.configure_orm(): Using pool settings. pool_size=5, pool_recycle=1800
Feb 20 18:54:45 ip-172-31-25-17.ec2.internal airflow[19660]: [2019-02-20 18:54:45 +0000] [19733] [INFO] Starting gunicorn 19.9.0
Feb 20 18:54:45 ip-172-31-25-17.ec2.internal airflow[19660]: Error: /run/airflow doesn't exist. Can't create pidfile.

调度程序似乎工作正常,在运行 systemctl status airflow-scheduler.service 后验证和 journalctl -f .

以下是以下 systemd 文件的设置:

/usr/lib/systemd/system/airflow-webserver.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=ec2-user
Type=simple
ExecStart=/bin/airflow scheduler
Restart=always
RestartSec=5s

[Install]
WantedBy=multi-user.target

/etc/tmpfiles.d/airflow.conf
D /run/airflow 0755 airflow airflow

/etc/sysconfig/airflow
AIRFLOW_CONFIG= $AIRFLOW_HOME/airflow.cfg
AIRFLOW_HOME= /home/ec2-user/airflow

在出现此错误之前,我将 Airflow 安装从根目录移动到主目录。不确定它是否会影响我的设置,但把它放在这里以防万一。

任何人都可以对错误以及如何修复它提供任何解释吗?我已尽力按照指示配置 systemd,但也许我遗漏了什么?

编辑 2:

抱歉,我粘贴了错误的代码。所以这是我的 Airflow webserver.service 代码
[Unit]
Description=Airflow webserver 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=ec2-user
Type=simple
ExecStart=/bin/airflow webserver --pid /run/airflow/webserver.pid
Restart=on-failure
RestartSec=5s
PrivateTmp=true

[Install]
WantedBy=multi-user.target

最佳答案

我也遇到了这个问题,并且能够通过在 [Service] 下提供运行时目录参数来解决这个问题。在 airflow-webserver.service单元文件:

[Service]
RuntimeDirectory=airflow
RuntimeDirectoryMode=0775

我不知道如何让它与 /etc/tmpfiles.d/airflow.conf 一起工作独自的。

关于amazon-ec2 - "Error:/run/airflow doesn' t 存在。将 systemd 用于 Airflow 网络服务器时可以为 't create pidfile.",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54793822/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com