首页 > 解决方案 > ADF-Postgres 超时

问题描述

我正在使用 ADF 和 Azure 托管 Postgres。我经常遇到查找和查询来源的复制活动在大约 35 秒后超时的问题。

Failure happened on 'Source' side. 'Type=Npgsql.NpgsqlException,Message=Exception while reading from stream,Source=Npgsql,''Type=System.IO.IOException,Message=Unable to read data from the transport connection: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.,Source=System,''Type=System.Net.Sockets.SocketException,Message=A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond,Source=System,' 

所以错误说这是一个 Npgsql 异常,所以我查看了他们的文档并修改了连接字符串以采用 Timeout = 60 和 CommandTimeout = 60(内部超时将默认为 CommandTimeout)。

并且查询仍然超时约 35 秒。这可能是导致超时的 Azure 托管实例的套接字问题,并且它只是传播到 npgsql 吗?

任何帮助,将不胜感激!

标签: postgresqlazure-data-factoryazure-data-factory-2azure-postgresql

解决方案


我只是想增加一些精度,因为我遇到了同样的问题(感谢@DeliciousMalware 和@Leon_Yue):

  • 对于使用 postgres 连接的请求,默认超时时间为 30 秒
  • 无法直接从查找活动更改此超时。
  • 唯一的选择是Timeout=600;CommandTimeout=0;在链接服务中添加连接字符串(例如,如果您使用密钥库)或在链接服务附加参数中添加选项,如@DeliciousMalware 屏幕截图。
  • Timeout是建立连接,CommandTimeout是命令本身的超时时间(秒,0表示无穷大)
  • 连接背后的库是 npgsql,其他可用的参数和详细信息都在那里:https ://www.npgsql.org/doc/connection-string-parameters.html

我很难找到连接字符串的参数是什么以及它们的含义,以及存在哪个参数,所以我真的很高兴找到这个文档。我没有在 azure 中找到很多关于 postgres 的文档,所以我认为这个参数列表对其他人有用。


推荐阅读