将Postgres从奴隶推广到主节点

发布于 2025-02-03 18:20:29 字数 642 浏览 4 评论 0原文

我有两个postgresql 11.4以主和节点运行。

我正在将大量数据插入主数据,以发现它在从属上被复制。 尝试模拟以下情况,

  • 请在从服务器上插入大量数据
  • pape_wal_replay
  • 等待WAL文件将Slave Files运送到Slave
  • insume_wal_replay从从服务器上
  • 立即在有多个WAL文件时立即促销 重播

如果此时发布 (当时有多个WAL时 - 已经发货并等待重播时),则会

  1. 重播所有现有的WAL文件[发货并等待重播] 或

  2. 接收促进信号后立即

    。 [不重播WAL文件等待 - 导致数据丢失? ]

如果是(1),如果主节点仍在发送WAL文件,我会尝试推广从属,会发生什么。它会忽略即将来临的WAL并提升自己吗?

希望PG专家能够阐明这一点。

PS:如果值得一提的话,我正在通过创建'pg_failover_trigger'来发出促进信号。

I have two postgresql 11.4 running as master and slave nodes.

I am inserting huge volume of data in master to see it get replicated on the slave.
Trying to simulate the following case,

  • Insert huge data
  • pause_wal_replay on slave
  • wait for the wal files to get shipped to slave
  • resume_wal_replay on slave
  • promote immediately when there are multiple wal files waiting to be replayed

If a promote signal is issued at this point [ When there are multiple wal - already shipped and waiting to be replayed ], When will slave promote itself?

  1. After replaying all the existing wal files [ shipped and waiting to be replayed ]
    or

  2. Immediately after receiving promote signal. [ Without replaying the wal files waiting - causing data loss ? ]

If it is (1), what happens if the master node is still sending wal files and I try to promote the slave. Does it ignore the incoming wal and promote itself?

Hoping PG Experts can shed light on this.

PS : I'm issuing promote signal by creating a 'pg_failover_trigger' if its worth mentioning.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

秋心╮凉 2025-02-10 18:20:30

升级后,备用服务器关闭了WAL接收器流程,并恢复了所有剩余的WAL。因此,我们从1中获得行为。

When it is promoted, the standby server shuts down the WAL receiver process and recovers all remaining WAL it has. So we get the behavior from 1.

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