gpt4 book ai didi

postgresql - Postgres 流复制错误 : requested WAL segment has already been removed

转载 作者:行者123 更新时间:2023-11-29 14:34:03 29 4
gpt4 key购买 nike

我在主服务器和辅助服务器之间设置了流式复制。我启用了存档。在 Postgres 日志文件中,我看到以下错误。

< 2017-12-05 03:08:45.374 UTC > WARNING:  archive_mode enabled, yet archive_command is not set
< 2017-12-05 03:08:46.668 UTC > ERROR: requested WAL segment 0000000100000000000000E3 has already been removed
< 2017-12-05 03:08:51.675 UTC > ERROR: requested WAL segment 0000000100000000000000E3 has already been removed
< 2017-12-05 03:08:56.682 UTC > ERROR: requested WAL segment 0000000100000000000000E3 has already been removed

我们是否需要为流复制启用archive_mode = on?如何避免上述错误?

max_wal_senders = 3
wal_keep_segements = 32

最佳答案

https://www.postgresql.org/docs/current/static/warm-standby.html

If you use streaming replication without file-based continuous archiving, the server might recycle old WAL segments before the standby has received them. If this occurs, the standby will need to be reinitialized from a new base backup. You can avoid this by setting wal_keep_segments to a value large enough to ensure that WAL segments are not recycled too early, or by configuring a replication slot for the standby. If you set up a WAL archive that's accessible from the standby, these solutions are not required, since the standby can always use the archive to catch up provided it retains enough segments.

强调我的。

所以要么将 wal_keep_segments 增加到足够大(足以满足您的 block 更改量),要么配置 archive_command 并设置一些存储空间以保持从 master 中删除的 wals可供奴隶使用。或者为备用配置一个复制槽...

关于postgresql - Postgres 流复制错误 : requested WAL segment has already been removed,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47645487/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com