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

时间:2017-07-29 10:25:35

标签: python airflow

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

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.

这很好。但是当我尝试启动webserver时

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

据我所知,端口正在使用。但是什么是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

2 个答案:

答案 0 :(得分:1)

为了完整起见:Thomas

在其他地方回答了这个问题
  

停止使用端口8080的Java应用程序或更改Airflow的端口。

Source

答案 1 :(得分:0)

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

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