气流:无法连接到('0.0.0.0',8080)

Airflow: Can't connect to ('0.0.0.0', 8080)

我在 Ubuntu 16.04,我已经用 pip 安装了 Airflow。下一步

airflow initdb
[2017-07-29 12:20:23,483] {__init__.py:57} INFO - Using executor SequentialExecutor
DB: sqlite:////home/milenko/airflow/airflow.db
[2017-07-29 12:20:23,813] {db.py:287} INFO - Creating tables
INFO  [alembic.runtime.migration] Context impl SQLiteImpl.

当我尝试启动网络服务器时fine.But这有效

airflow webserver -p 8080
[2017-07-29 12:20:45,913] [4585] {models.py:167} INFO - Filling up the DagBag from /home/milenko/airflow/dags
Running the Gunicorn Server with:
Workers: 4 sync
Host: 0.0.0.0:8080
Timeout: 120
Logfiles: - -
=================================================================            
[2017-07-29 12:20:46,950] {__init__.py:57} INFO - Using executor SequentialExecutor
[2017-07-29 12:20:47 +0200] [4590] [INFO] Starting gunicorn 19.3.0
[2017-07-29 12:20:47 +0200] [4590] [ERROR] Connection in use: ('0.0.0.0', 8080)
[2017-07-29 12:20:47 +0200] [4590] [ERROR] Retrying in 1 second.
[2017-07-29 12:20:48 +0200] [4590] [ERROR] Connection in use: ('0.0.0.0', 8080)
[2017-07-29 12:20:48 +0200] [4590] [ERROR] Retrying in 1 second.
[2017-07-29 12:20:49 +0200] [4590] [ERROR] Connection in use: ('0.0.0.0', 8080)
[2017-07-29 12:20:49 +0200] [4590] [ERROR] Retrying in 1 second.
[2017-07-29 12:20:50 +0200] [4590] [ERROR] Connection in use: ('0.0.0.0', 8080)
[2017-07-29 12:20:50 +0200] [4590] [ERROR] Retrying in 1 second.
[2017-07-29 12:20:51 +0200] [4590] [ERROR] Connection in use: ('0.0.0.0', 8080)
[2017-07-29 12:20:51 +0200] [4590] [ERROR] Retrying in 1 second.
[2017-07-29 12:20:52 +0200] [4590] [ERROR] Can't connect to ('0.0.0.0', 8080)

如何解决?是不是Gunicorn服务器的问题? 使用 netstat 我得到了这个输出

sudo netstat -nlp | grep :80
tcp6       0      0 :::8080                 :::*                    LISTEN      1711/java

据我了解,端口在 use.But 什么是 1711/java?如果我将其关闭,是否会影响其他内容? 这是我的气流配置文件的相关部分

[webserver]
# The base url of your website as airflow cannot guess what domain or
# cname you are using. This is used in automated emails that
# airflow sends to point links to the right web server
base_url = http://localhost:8080

# The ip specified when starting the web server
web_server_host = 0.0.0.0

# The port on which to run the web server
web_server_port = 8080

# Paths to the SSL certificate and key for the web server. When both are
# provided SSL will be enabled. This does not change the web server port.
web_server_ssl_cert =
web_server_ssl_key =

# Number of seconds the gunicorn webserver waits before timing out on a worker
web_server_worker_timeout = 120

# Number of workers to refresh at a time. When set to 0, worker refresh is
# disabled. When nonzero, airflow periodically refreshes webserver workers by
# bringing up new ones and killing old ones.
worker_refresh_batch_size = 1

# Number of seconds to wait before refreshing a batch of workers.
worker_refresh_interval = 30

# Secret key used to run your flask app
secret_key = temporary_key

# Number of workers to run the Gunicorn web server
workers = 4

# The worker class gunicorn should use. Choices include
# sync (default), eventlet, gevent
worker_class = sync

为了完整起见:Thomas:

在别处回答了这个问题

Either stop the Java application that uses port 8080 already or change the port for Airflow.

Source

第一次 运行 Airflow 时,它会在 $AIRFLOW_HOME 目录(默认为 ~/airflow)中创建一个名为 airflow.cfg 的文件。此文件包含 Airflow 的配置,您可以编辑它以更改任何设置。

您可以找到此文件并搜索 web_server_port。然后将其更改为任何未使用的端口。然后你可以像往常一样 运行 airflow webserver

我遇到了同样的问题,默认端口 8080 被另一个进程使用。要解决此问题,请将端口从 8080 更改为 8081.

转到您的 airflow 目录并在编辑器中打开 airflow.cfg。将端口 8080 的所有实例更改为 8081。现在使用端口 8081.

保存并重新运行调度程序和网络服务器