PostgreSQL恢复投掷错误:不存在复制插槽
环境:PostgreSQL 13.x
(Dockerized)
我试图测试PostgreSQL节点的DR设置。 pg_basebackup和wal_files档案是从待机模式中获取的。
通过复制pg_basebackup
和配置的postgresql.conf
使用RESTORE_COMMAND
指向Walfiles Archive。
#----------------------- RECOVERY CONFIGS -----------------------
restore_command = 'cp /db-restore/mydb/walfiles/%f "%p"'
recovery_target_timeline = 'latest'
recovery_target_action = promote
- 恢复似乎很好。一些随机
选择
查询返回正确结果的查询。 - 但是logfile经常下出错误。
2022-04-19 10:19:53 UTC [291] rep_usr@[unknown] ERROR: replication slot "slot_name" does not exist
2022-04-19 10:19:58 UTC [296] rep_usr@[unknown] ERROR: replication slot "slot_name" does not exist
正如我从Standby中备份的那样,此修复工作是否使新节点成为备用,并寻找上一代中使用的
replication_slot
?如何使新节点作为主节点(remove replication_slot信息)
如果从备用中备份备份,可以恢复哪些适当的步骤。
我有1个主人和2个待机节点。并计划从待机中备份。因此,在备用节点上使用此时,是否需要
Archive_Mode
和Archive_Command
需要任何特定的更改?当前命令:
archive_mode = always
archive_level = logical
archive_command = 'test ! -f /db-archives/walfiles/%f && cp %p /db-archives/walfiles/%f'"
有人可以帮忙吗?有指针吗?
我敢肯定,db-backup将获得有关replication_slot和connection_info的信息,因为pg_basebackup
本身是整个DB的克隆。要恢复配置,我正在手动删除postgresql.auto.conf
in main
目录,其中包含上述参数。
- 那么,如果DB备份中有任何其他引用,我如何删除
replication_slot
的任何其他引用?
Environment: Postgresql 13.x
(dockerized)
I was trying to test the DR setup for PostgreSQL nodes.
pg_basebackup and wal_files archive was taken from the standby mode.
Done restoration on a new node by copying pg_basebackup
and configured postgresql.conf
to use restore_command
pointing to walfiles archive.
#----------------------- RECOVERY CONFIGS -----------------------
restore_command = 'cp /db-restore/mydb/walfiles/%f "%p"'
recovery_target_timeline = 'latest'
recovery_target_action = promote
- recovery seems to be fine. Some random
select
queries returning correct results. - But logfile is throwing below error frequently.
2022-04-19 10:19:53 UTC [291] rep_usr@[unknown] ERROR: replication slot "slot_name" does not exist
2022-04-19 10:19:58 UTC [296] rep_usr@[unknown] ERROR: replication slot "slot_name" does not exist
As I have taken backup from standby, is this restoration making new node as a standby and looking for the
replication_slot
it used in the previous generation?How can I make new node as a Master (remove replication_slot info)
What are the proper steps to recover if the backup was taken from standby.
I have 1 master and 2 standby nodes. And planning to take a backup from a standby. So is there any specific changes required for
archive_mode
andarchive_command
when using this on a standby node? Current commands:
archive_mode = always
archive_level = logical
archive_command = 'test ! -f /db-archives/walfiles/%f && cp %p /db-archives/walfiles/%f'"
Could someone help with this? Any pointers?
I am sure, db-backup will have info about replication_slot and connection_info as the pg_basebackup
itself is a clone of entire DB. To revert configs, I am manually removing postgresql.auto.conf
in main
directory which contains above parameters.
- So how can I remove any other references of
replication_slot
if there are any in the DB backup?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我删除了所有配置,并从新鲜开始。
Main/Postgresql.auto.conf
,它存在于备份中。main/postgresql.auto.conf
当我们服用pg_basebackup
时,存在于待机节点中。包含备用节点中用于pg_basebackup的配置。 (slot_name和connect_info)。当我将备份从备用到主人的备份时,我不需要
postgresql.auto.conf
。I removed all configs and started with fresh.
main/postgresql.auto.conf
which was present in the backup.main/postgresql.auto.conf
is present in standby nodes when we takepg_basebackup
. contains the configs used for pg_basebackup in standby nodes. (slot_name, and connect_info).As I was restoring backup from standby to a Master, I don't need that
postgresql.auto.conf
.这些错误消息似乎不是通过恢复来抛出的,而是通过将作为数据库用户
rep_usr
连接的其他一些工具抛出的。如果您的应用程序需要,请创建复制插槽!
These error messages don't seem to be thrown by recovery, but by some other tool that connects as database user
rep_usr
.Create the replication slot if your application needs it!