首页 > 解决方案 > pg_rewind:源和目标集群在同一时间线上

问题描述

我尝试source/target使用pg_rewind以下命令在集群之间进行同步。 而且我知道 100%source/target集群中的内容不再相同。

/usr/pgsql-12/bin/pg_rewind --source-server="192.168.100.100 user=postgres password=mypassword"  -D /var/lib/pgsql/12/data --progress

pg_rewind给出以下消息

pg_rewind: source and target cluster are on the same timeline
pg_rewind: no rewind required

我不明白pg_wal&base目录的内容有何不同,source/target但没有pg_rewind意识到!

标签: postgresqlpostgresql-12

解决方案


pg_rewind仅在最新的公共检查点之后撤消目标服务器上的数据修改。

在最新的公共检查点之后在源服务器上发生的修改将被忽略 - 当目标服务器成为源服务器的备用服务器时,这些将被恢复。

因此,目标服务器可能在源服务器升级之前就被彻底关闭了。

关于时间线的消息是巧合,不是第二条消息的原因。


推荐阅读