PostgreSQL恢复投掷错误:不存在复制插槽

发布于 2025-01-22 17:35:58 字数 1571 浏览 0 评论 0原文

环境: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_ModeArchive_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 and archive_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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

記憶穿過時間隧道 2025-01-29 17:35:58

我删除了所有配置,并从新鲜开始。

  • 删除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.

  • removed main/postgresql.auto.conf which was present in the backup.
  • main/postgresql.auto.conf is present in standby nodes when we take pg_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.

咽泪装欢 2025-01-29 17:35:58

这些错误消息似乎不是通过恢复来抛出的,而是通过将作为数据库用户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!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文