编辑
2024-06-26
数据相关
00
请注意,本文编写于 302 天前,最后修改于 302 天前,其中某些信息可能已经过时。

目录

pg_dump导出数据库报错处理
问题解释
建议的解决方案

pg_dump导出数据库报错处理

使用的备份语句如下:

js
d:\Program Files\pgAdmin 4\runtime\pg_dump.exe --file "D:\\sunac_work\\sentry_data_backup_0626.sql" --host "172.17.36.76" --port "31263" --username "postgres" --no-password --format=c --large-objects --verbose "sentry"

报错如下:

image.png

js
pg_dump: dumping contents of table "public.hybridcloud_orgauthtokenreplica" pg_dump: dumping contents of table "public.hybridcloud_regioncacheversion" pg_dump: dumping contents of table "public.nodestore_node" pg_dump: error: Dumping the contents of table "nodestore_node" failed: PQgetResult() failed. pg_dump: detail: Error message from server: ERROR: canceling statement due to conflict with recovery DETAIL: User query might have needed to see row versions that must be removed. pg_dump: detail: Command was: COPY public.nodestore_node (id, data, "timestamp") TO stdout;

问题解释

如果您具有副本/从属配置并且使用该副本/从属进行备份,那么如果查询花费太长时间才能读取,则返回的结果可能不再存在或在主节点上已更改。

建议的解决方案

在副本节点上编辑postgresql.conf并设置以下两个值:

js
max_standby_archive_delay = 900s max_standby_streaming_delay = 900s

这样,持续时间少于 900 秒的从属/副本上的查询就不会被快速取消,从而为其提供更多时间来完成。

相关信息

max_standby_streaming_delay:设置热备服务器处理流式 WAL数据 max_standby_archive_delay:设置热备服务器处理归档 WAL 数据时取消查询之前的最大延迟

本文作者:Kevin@灼华

本文链接:

版权声明:本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!