postgresql - 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 吗?
任何帮助,将不胜感激!
解决方案
我只是想增加一些精度,因为我遇到了同样的问题(感谢@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 的文档,所以我认为这个参数列表对其他人有用。
推荐阅读
- python - 在没有脚本文件的情况下将命令行参数传递给 python 解释器
- vue.js - Vuex 突变通过异步/等待操作更新具有动态属性名称的对象
- c# - 使用与本地机器不同的时间
- date - 如何在 Excel 中根据因子和当前日期为单元格着色?
- angularjs - 我第一次尝试 $http 代码但没有得到结果。我的代码有什么问题
- python - 在 Raspberry pi 上启动时启动 python 脚本有困难
- c# - 从收到的消息中呼叫桌面通知
- jboss-eap-6 - 如何在 JBoss EAP 6.4 中通过 Internet 远程访问管理控制台
- python - 使用 win32com 库从 python 脚本保存 Excel 文件
- node.js - 配置 SAML 单点注销 (Okta/NodeJS/saml2-js)。注销响应端点应该做什么?