pg_rewind 源端时间线发生改变 同步失败

master-standby情况下,发生如下行为:

1.master停掉后,standby做为新的master(可能存在部分事物没有同步到standby中)。

2.新master运行过程中出错,进行恢复,时间线发生变化。

3.旧master启动前,先跟新master进行pg_rewind,会出现时间线不一致的问题。

 

-bash-4.1$ pg_rewind --target-pgdata='xxx' --source-server='host=xx.xx.xx.xx port=xxxx dbname=xx user=xx password=xxxx' -P

connected to server

could not find common ancestor of the source and target cluster's timelines
Failure, exiting

 

参考这个也不行:

“修改新的主库history文件, 把最后一行放上来即可.“

http://www.ithao123.cn/content-134160.html

 

pg_rewind:standby节点promote后, 主节点和备节点都发生了变更的情况, 当然发生变更产生的wal必须存在. 如果old primary发生的变更已经在归档目录, 需要先手工将这些变更拷贝到pg_xlog目录. 备节点发生的变更无所谓, 因为可以通过recovery.conf来解决.

posted @ 2017-06-09 17:49  狂神314  阅读(753)  评论(0编辑  收藏  举报