气流:端口 8080 和 8081 上的 'ERR_CONNECTION_REFUSED'

Airflow: 'ERR_CONNECTION_REFUSED' on port 8080 & 8081

我在下面的 ami 上安装了 airflow (v 2.2.4):

它当前所在的文件夹在这里(但是我应该根据这些 docs 将其重新定位到其他地方吗?)

/home/ec2-user/airflow/airflow.cfg
##WHEN I RUN echo $AIRFLOW_HOME I get the below:
/home/ec2-user/airflow

AMI 信息:

NAME="Amazon Linux"
VERSION="2"
ID="amzn"
ID_LIKE="centos rhel fedora"
VERSION_ID="2"
PRETTY_NAME="Amazon Linux 2"
ANSI_COLOR="0;33"
CPE_NAME="cpe:2.3:o:amazon:amazon_linux:2"
HOME_URL="https://amazonlinux.com/"
POSTGRES V = 10.17

我遇到的问题是,在我 运行 airflow initdb - 效果很好之后,我 运行 airflow webserver 并且当我尝试在“Listening at”之后复制 http 值时: 我在 google chrome 中收到 ERR_CONNECTION_REFUSED“无法访问此站点”错误(与其他浏览器相同)。

 ____________       _____________
 ____    |__( )_________  __/__  /________      __
____  /| |_  /__  ___/_  /_ __  /_  __ \_ | /| / /
___  ___ |  / _  /   _  __/ _  / / /_/ /_ |/ |/ /
 _/_/  |_/_/  /_/    /_/    /_/  \____/____/|__/
[2022-04-05 18:08:55,769] {dagbag.py:500} INFO - Filling up the DagBag from /dev/null
[2022-04-05 18:08:55,819] {manager.py:779} WARNING - No user yet created, use flask fab command to do it.
[2022-04-05 18:08:56,185] {manager.py:512} WARNING - Refused to delete permission view, assoc with role exists DAG Runs.can_create User
Running the Gunicorn Server with:
Workers: 4 sync
Host: 0.0.0.0:8081
Timeout: 120
Logfiles: - -
Access Logformat: 
=================================================================            
[2022-04-05 18:08:58 +0000] [9318] [INFO] Starting gunicorn 20.1.0
[2022-04-05 18:08:58 +0000] [9318] [INFO] Listening at: http://0.0.0.0:8081 (9318)
[2022-04-05 18:08:58 +0000] [9318] [INFO] Using worker: sync
[2022-04-05 18:08:58 +0000] [9321] [INFO] Booting worker with pid: 9321
[2022-04-05 18:08:58 +0000] [9322] [INFO] Booting worker with pid: 9322
[2022-04-05 18:08:59 +0000] [9323] [INFO] Booting worker with pid: 9323
[2022-04-05 18:08:59 +0000] [9324] [INFO] Booting worker with pid: 9324
[2022-04-05 18:09:00,798] {manager.py:779} WARNING - No user yet created, use flask fab command to do it.
[2022-04-05 18:09:00,845] {manager.py:779} WARNING - No user yet created, use flask fab command to do it.
[2022-04-05 18:09:01,084] {manager.py:779} WARNING - No user yet created, use flask fab command to do it.
[2022-04-05 18:09:01,182] {manager.py:779} WARNING - No user yet created, use flask fab command to do it.
[2022-04-05 18:09:01,575] {manager.py:512} WARNING - Refused to delete permission view, assoc with role exists DAG Runs.can_create User
[2022-04-05 18:09:01,605] {manager.py:512} WARNING - Refused to delete permission view, assoc with role exists DAG Runs.can_create User
[2022-04-05 18:09:01,888] {manager.py:512} WARNING - Refused to delete permission view, assoc with role exists DAG Runs.can_create User

这最初发生在端口 8080 上,但据此 post 我尝试了一个新端口 - 但仍然没有成功。 Airflow 配置详情如下:

# If you set web_server_url_prefix, do NOT forget to append it here, ex:
# ``endpoint_url = http://localhost:8080/myroot``
# So api will look like: ``http://localhost:8080/myroot/api/experimental/...``
endpoint_url = http://localhost:8081

[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:8081

# Default timezone to display all dates in the UI, can be UTC, system, or 
# any IANA timezone string (e.g. Europe/Amsterdam). If left empty the
# default value of core/default_timezone will be used
# Example: default_ui_timezone = America/New_York
default_ui_timezone = UTC

# 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 = 8081

这不是 Airflow 问题 - 这是基本的远程计算问题。

你 运行 远程机器上的气流。

如果您使用本地主机,请尝试连接到本地主机。您需要确保连接到远程计算机而不是本地主机。

您需要设置一些方法来打开您的端口,以便可以从浏览器所在的本地计算机访问。

您可以按照此处描述的方式进行操作:

https://aws.amazon.com/blogs/aws/new-port-forwarding-using-aws-system-manager-sessions-manager/