接上回,备机在检测到主机挂掉后,备机通过standby promote成功升级为主机继续提供服务

此时集群状态如下:

repmgr+pg12集群,挂掉的主机如何手动加入集群

接下来需要恢复原主机为备机加入集群继续提供服务

1、主机执行node rejoin,将节点重新加入集群:

./repmgr node rejoin -h192.168.101.7 -Upostgres -dpostgres
[postgres@localhost bin]$ ./repmgr node rejoin -h192.168.101.7 -Upostgres -dpostgres
ERROR: this node cannot attach to rejoin target node 2
DETAIL: rejoin target server's timeline 2 forked off current database system timeline 1 before current recovery point 0/8000028
HINT: use --force-rewind to execute pg_rewind

报错日志可以看出,此时的节点和现在的主节点日志发生了分歧,需要调用--force-rewind重做备机,执行如下命令即可

./repmgr node rejoin -h192.168.101.7 -Upostgres -dpostgres --force-rewind

repmgr+pg12集群,挂掉的主机如何手动加入集群

 

 检查节点状态,可知原主机成功作为备机加入集群提供服务

./repmgr cluster show

repmgr+pg12集群,挂掉的主机如何手动加入集群

 

 

 ps:调用pg_rewind重做备机有丢失原主机数据风险,需要注意。


 
                    
            
                

相关文章:

  • 2022-12-23
  • 2021-04-06
  • 2021-10-06
  • 2021-07-31
  • 2021-10-26
  • 2021-12-07
  • 2022-12-23
  • 2021-06-02
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-19
  • 2021-07-29
  • 2022-12-23
  • 2021-08-26
相关资源
相似解决方案