【问题标题】:Airflow SFTPOperator keeps timing out before PUTting fileAirflow SFTPOperator 在 PUTting 文件之前一直超时
【发布时间】:2021-02-18 18:29:49
【问题描述】:

我有一个 DAG,可以将文件从 GCS 下载到本地气流临时文件夹

tmp_local_filepath="/usr/local/airflow/"+...

然后有操作员将其发送到 SFTP 文件夹

sftp_transfer = SFTPOperator(
    dag=dag,
    task_id="file-copy-gsc-to-sftp",
    ssh_hook=SSHHook("sftp_conn"),
    local_filepath=tmp_local_filepath,
    remote_filepath=ftp_remote_filepath,
    operation="put",
    )

但是由于超时错误,它会间歇性地失败(大约 50% 的时间)。

Error while transferring None, error: [Errno 110] Connection timed out

我试过了:

  • 更改 FTP 和 SSH 之间的连接类型
  • 在连接Extras中添加{"timeout"="60"}以延长时间
  • 如上所述将其添加为 SSHHook - DAG 是从旧的稳定系统(几乎完好无损)迁移而来的,该系统直接使用连接而不创建挂钩。

它仍然有一半时间超时,我不知道为什么,但这是我需要稳定的关键功能。

我们正在 Astronomer 上运行 Airflow v1.10.7+astro.11

现在欢迎任何建议,因为我正在拔头发! :)

【问题讨论】:

    标签: ssh timeout airflow sftp


    【解决方案1】:

    事实证明,Astronomer 在 2021 年 1 月添加了 3 个新的传出 IP 地址 - 因此,如果他们出于安全考虑使用白名单,则这些都需要添加到接收 SFTP 服务器白名单中。虽然这只是在 Astronomer 上使用 Airflow 的人的问题,但如果您遇到与 SFTP 操作员类似的问题,希望它会提示您检查新的 IP 地址。

    • 35.245.140.149(原始 IP 地址,仍在使用中)
    • 35.245.44.221
    • 34.86.203.139
    • 35.199.31.94

    来源: https://www.astronomer.io/docs/cloud/stable/manage-astronomer/vpc-access

    【讨论】:

      猜你喜欢
      • 2012-08-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-08-18
      • 2021-06-15
      • 2021-05-21
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多