【问题标题】:airflow gunircorn [CRITICAL] WORKER TIMEOUT气流 gunircorn [CRITICAL] 工作人员超时
【发布时间】:2020-03-20 09:50:49
【问题描述】:

我正在尝试使用我的 fork airflowapache/airflowv1-10-stable 分支在 ECS 中运行 apache 气流。我正在使用环境变量将执行程序、Postgres 和 Redis 信息设置到网络服务器。

AIRFLOW__CORE__SQL_ALCHEMY_CONN="postgresql+psycopg2://airflow_user:airflow_password@postgres:5432/airflow_db"
AIRFLOW__CELERY__RESULT_BACKEND="db+postgresql://airflow_user:airflow_password@postgres:5432/airflow_db"
AIRFLOW__CELERY__BROKER_URL="redis://redis_queue:6379/1"
AIRFLOW__CORE__EXECUTOR=CeleryExecutor
FERNET_KEY=46BKJoQYlPPOexq0OhDZnIlNepKFf87WFwLbfzqDDho=
AIRFLOW__CORE__LOAD_EXAMPLES=False

我使用CMD-SHELL [ -f /home/airflow/airflow/airflow-webserver.pid ] 作为 ECS 容器的健康检查。我可以从 docker 容器连接到 Postgres 和 Redis,因此也不存在安全组问题。

通过docker ps我可以看到容器是健康的并且容器端口映射到ec2实例0.0.0.0:32794->8080/tcp

但是当我尝试打开网络服务器 UI 时,它并没有打开。即使卷曲它也不起作用。我已经尝试了来自 ec2-instance 的curl localhost:32794 和来自容器的curl localhost:8080,但它们都没有工作。 telnet 在这两种情况下都有效。

在容器日志中,我可以看到 gunicorn 工作人员不断超时

[2019-11-25 05:30:39,236] {__init__.py:51} INFO - Using executor CeleryExecutor
[2019-11-25 05:30:39 +0000] [11] [CRITICAL] WORKER TIMEOUT (pid:17337)
[2019-11-25 05:30:39 +0000] [17337] [INFO] Worker exiting (pid: 17337)
[2019-11-25 05:30:39,430] {dagbag.py:90} INFO - Filling up the DagBag from /home/airflow/airflow/dags
[2019-11-25 05:30:39,472] {dagbag.py:90} INFO - Filling up the DagBag from /home/airflow/airflow/dags
[2019-11-25 05:30:39,479] {__init__.py:51} INFO - Using executor CeleryExecutor
[2019-11-25 05:30:39,447] {__init__.py:51} INFO - Using executor CeleryExecutor
[2019-11-25 05:30:39,524] {__init__.py:51} INFO - Using executor CeleryExecutor
[2019-11-25 05:30:39,719] {__init__.py:51} INFO - Using executor CeleryExecutor
[2019-11-25 05:30:39,930] {dagbag.py:90} INFO - Filling up the DagBag from /home/airflow/airflow/dags
[2019-11-25 05:30:40,139] {dagbag.py:90} INFO - Filling up the DagBag from /home/airflow/airflow/dags
[2019-11-25 05:30:40,244] {dagbag.py:90} INFO - Filling up the DagBag from /home/airflow/airflow/dags
[2019-11-25 05:30:40 +0000] [11] [CRITICAL] WORKER TIMEOUT (pid:17338)
[2019-11-25 05:30:40 +0000] [11] [CRITICAL] WORKER TIMEOUT (pid:17339)
[2019-11-25 05:30:40 +0000] [17393] [INFO] Booting worker with pid: 17393
[2019-11-25 05:30:40,412] {dagbag.py:90} INFO - Filling up the DagBag from /home/airflow/airflow/dags

ec2-instance 正在使用Amazon Linux 2,我可以在/var/log/messages 中不断地查看这些日志

Nov 25 05:57:15 ip-172-31-67-43 ec2net: [rewrite_aliases] Rewriting aliases of eth0
Nov 25 05:58:16 ip-172-31-67-43 dhclient[2724]: XMT: Solicit on eth0, interval 131000ms.
Nov 25 06:00:27 ip-172-31-67-43 dhclient[2724]: XMT: Solicit on eth0, interval 127900ms.
Nov 25 06:01:01 ip-172-31-67-43 systemd: Created slice User Slice of root.
Nov 25 06:01:01 ip-172-31-67-43 systemd: Starting User Slice of root.
Nov 25 06:01:01 ip-172-31-67-43 systemd: Started Session 77 of user root.
Nov 25 06:01:01 ip-172-31-67-43 systemd: Starting Session 77 of user root.
Nov 25 06:01:01 ip-172-31-67-43 systemd: Removed slice User Slice of root.
Nov 25 06:01:01 ip-172-31-67-43 systemd: Stopping User Slice of root.
Nov 25 06:02:35 ip-172-31-67-43 dhclient[2724]: XMT: Solicit on eth0, interval 131620ms.
Nov 25 06:04:36 ip-172-31-67-43 systemd: Started Session 78 of user ec2-user.
Nov 25 06:04:36 ip-172-31-67-43 systemd-logind: New session 78 of user ec2-user.
Nov 25 06:04:36 ip-172-31-67-43 systemd: Starting Session 78 of user ec2-user.
Nov 25 06:04:46 ip-172-31-67-43 dhclient[2724]: XMT: Solicit on eth0, interval 125300ms.
Nov 25 06:06:52 ip-172-31-67-43 dhclient[2724]: XMT: Solicit on eth0, interval 115230ms.
Nov 25 06:08:47 ip-172-31-67-43 dhclient[2724]: XMT: Solicit on eth0, interval 108100ms.

【问题讨论】:

    标签: docker airflow gunicorn amazon-ecs


    【解决方案1】:

    关于这些超时错误:

    [CRITICAL] WORKER TIMEOUT
    

    您可以通过这两个 Airflow 环境变量设置 Gunicorn 超时:

    AIRFLOW__WEBSERVER__WEB_SERVER_MASTER_TIMEOUT
    

    网络服务器在杀死没有响应的 gunicorn master 之前等待的秒数。

    AIRFLOW__WEBSERVER__WEB_SERVER_WORKER_TIMEOUT
    

    gunicorn 网络服务器在工作线程超时之前等待的秒数。

    请参阅Airflow documentation 了解更多信息。

    我必须为我的 Airflow 安装解决此错误。我将这两个超时都设置为 300 秒,这样我就可以加载 Airflow Web UI,这样我就可以调试页面加载缓慢的根本原因。

    【讨论】:

    • 你还记得根本原因是什么吗?也许是加载缓慢的 DAG?我遇到了同样的问题,我不确定增加超时是否会解决它
    【解决方案2】:

    在将 AIRFLOW_HOME 设置为我的 EFS 挂载时部署 Airflow 时出现此错误。将其设置为 ~/airflow 可解决此问题。

    【讨论】:

      猜你喜欢
      • 2020-08-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-09-26
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多