ADF-Postgres 超时

Rob*_*ley 6 postgresql azure-data-factory azure-postgresql

我正在使用 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,' 
Run Code Online (Sandbox Code Playgroud)

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

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

任何帮助,将不胜感激!

小智 6

我只是想增加一些精度,因为我遇到了同样的问题(感谢@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 上找到很多文档,所以我认为这个参数列表对其他人会有一些用处。


小智 5

我添加了 Leon 建议的 2 个参数,这解决了我遇到的问题。

以下是添加到链接服务的参数的屏幕截图:

这是错误和完成运行的屏幕截图:

这是错误和完成运行的屏幕截图: