zoukankan      html  css  js  c++  java
  • PostgreSQL 主备流复制启动过程(摘)

    摘要:

    流复制启动过程中,首先启动的startup进程, 然后触发启动wal receiver进程,之后wal receiver发送信号,启动wal sender进程。

    1.Startup进程启动条件很简单,在流复制场景中,只要数据库实例进入standby模式(即在recovery.conf中配置standby_mode=on), startup就会随着数据库服务启动。

    2. Startup启动后,不会马上发送信号给postmaster来启动wal receiver进程,它先会进行一系列条件的判断然后决定是否通知postmaster启动wal receiver进程。 首先它会检查接下来要replay的wal是否本地已经存在,还是需要从primary节点发送过来。只有当需要从primary节点发送wal时, 才会触发startup发送信号给postmaster请求创建wal receiver进程。

    系统在恢复过程中,获取WAL Segment是按照以下顺序执行:

             1. 先从归档中获取

             2. 然后再从pg_wal中获取

             3. 最后需要从primary 节点以流复制方式获取

    所以在实际流复制过程中, 如果是非归档,则从会pg_wal中获取;否则优先从archive归档中获取(Archive Mode); 如果两者都没有startup要恢复的wal,则startup会发送信号(通过函数SendPostmasterSignal(PMSIGNAL_START_WALRECEIVER) )给postmaster进程,请求其需要启动wal receiver进程以便从Primary节点来获取wal数据。

    引自:

    https://my.oschina.net/tianbing/blog/3007651

    https://my.oschina.net/tianbing?tab=newest&catalogId=3734302

  • 相关阅读:
    URAL 2015 Zhenya moves from the dormitory(水题)
    概率DP总结(待整理)
    HDU 5236 Article(概率DP+贪心 待解决)
    2015上海邀请赛
    树链剖分(待整理)
    hust 5239 Doom(线段树 规律OR数论 待整理 )
    Java大数BigInteger BigDecimal
    hdu 5505 GT and numbers
    hdu 5532 Almost Sorted Array
    hdu 5533 Dancing Stars on Me
  • 原文地址:https://www.cnblogs.com/kuang17/p/12611967.html
Copyright © 2011-2022 走看看