【问题标题】:How to run airflow webserver on port 80如何在端口 80 上运行气流网络服务器
【发布时间】:2017-08-30 07:01:03
【问题描述】:

当我将气流网络服务器设置为在端口 80 上运行时,服务未执行并且失败并出现以下错误:

...
[2017-08-30 06:26:35,286] {__init__.py:57} INFO - Using executor CeleryExecutor
[2017-08-30 06:26:35,421] {driver.py:120} INFO - Generating grammar tables from /usr/lib/python3.5/lib2to3/Grammar.txt
[2017-08-30 06:26:35,463] {driver.py:120} INFO - Generating grammar tables from /usr/lib/python3.5/lib2to3/PatternGrammar.txt
[2017-08-30 06:26:35 +0000] [9401] [INFO] Starting gunicorn 19.3.0
[2017-08-30 06:26:35 +0000] [9401] [ERROR] Retrying in 1 second.
[2017-08-30 06:26:36 +0000] [9401] [ERROR] Retrying in 1 second.
[2017-08-30 06:26:37 +0000] [9401] [ERROR] Retrying in 1 second.
[2017-08-30 06:26:38 +0000] [9401] [ERROR] Retrying in 1 second.
[2017-08-30 06:26:39 +0000] [9401] [ERROR] Retrying in 1 second.
[2017-08-30 06:26:40 +0000] [9401] [ERROR] Can't connect to ('0.0.0.0', 80)
...

在 AWS 上托管的 Ubuntu 16.04 上使用 systemd。如果在端口 8080 上运行,整个设置运行良好。

相关配置部分:

$ grep web_server_port /home/ubuntu/airflow/airflow.cfg
web_server_port = 80

服务配置:

$ cat /usr/lib/systemd/system/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]
User=ubuntu
Group=ubuntu
Type=simple
ExecStart=/usr/local/bin/airflow webserver --pid /home/ubuntu/airflow/webserver.pid
Restart=on-failure
RestartSec=5s
PrivateTmp=true

[Install]
WantedBy=multi-user.target

【问题讨论】:

    标签: webserver apache-airflow


    【解决方案1】:

    问题是端口 80 只能由 root 使用。解决问题所需的/usr/lib/systemd/system/airflow-webserver.service 的唯一更改是:

    • 删除UserGroup:root 是默认值
    • 设置气流主页环境变量:否则服务会在/root/airflow 中寻找气流

    新的服务配置:

    $ cat /usr/lib/systemd/system/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]
    Environment=AIRFLOW_HOME=/home/ubuntu/airflow
    Type=simple
    ExecStart=/usr/local/bin/airflow webserver --pid /home/ubuntu/airflow/webserver.pid
    Restart=on-failure
    RestartSec=5s
    PrivateTmp=true
    
    [Install]
    WantedBy=multi-user.target
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-06-09
      • 2021-10-07
      • 1970-01-01
      • 2022-01-25
      • 2021-06-12
      • 2021-09-16
      • 2013-09-16
      相关资源
      最近更新 更多