微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

PostgreSQL 12复制失败

如何解决PostgreSQL 12复制失败

我正在尝试复制仍在运行/正在主动接受来自用户的请求(例如插入和更新)的数据库服务器。

我运行了下面提到的此命令,开始将主服务器复制到复制服务器:

 root@replica:~#sudo -u postgres pg_basebackup -h [PRIMARY_IP] -D /var/lib/postgresql/12/main -U replication -P -v

备份过程没有错误并完成了,但是尝试启动postgresql服务器时遇到如下错误

root@replica:~#tail /var/log/postgresql/postgresql-12-main.log

2020-10-03 01:15:12.198 UTC [552567] FATAL:  database system identifier differs between the primary and standby
2020-10-03 01:15:12.198 UTC [552567] DETAIL:  The primary's identifier is 6805716485467355646,the standby's identifier is 6875279138564418280.
2020-10-03 01:15:17.204 UTC [552568] FATAL:  database system identifier differs between the primary and standby
2020-10-03 01:15:17.204 UTC [552568] DETAIL:  The primary's identifier is 6805716485467355646,the standby's identifier is 6875279138564418280.
2020-10-03 01:15:22.207 UTC [552570] FATAL:  database system identifier differs between the primary and standby
2020-10-03 01:15:22.207 UTC [552570] DETAIL:  The primary's identifier is 6805716485467355646,the standby's identifier is 6875279138564418280.
2020-10-03 01:15:27.212 UTC [552579] FATAL:  database system identifier differs between the primary and standby
2020-10-03 01:15:27.212 UTC [552579] DETAIL:  The primary's identifier is 6805716485467355646,the standby's identifier is 6875279138564418280.
2020-10-03 01:15:32.216 UTC [552581] FATAL:  database system identifier differs between the primary and standby
2020-10-03 01:15:32.216 UTC [552581] DETAIL:  The primary's identifier is 6805716485467355646,the standby's identifier is 6875279138564418280.

有人知道如何解决此问题而无需再次尝试pg_basebackup处理吗?因为这花了我很多时间和带宽。

解决方法

是的,我以前从未复制过它。我遵循@jjanes的建议,我删除了以前的副本,然后运行:

sudo -u postgres pg_basebackup -h [PRIMARY_IP] -D /var/lib/postgresql/12/main -U replication -P -v -R -X stream -C -S pgbackup1

及其工作。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。