Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/postgresql/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Postgresql 12复制失败_Postgresql_Database Replication - Fatal编程技术网

Postgresql 12复制失败

Postgresql 12复制失败,postgresql,database-replication,Postgresql,Database Replication,我正在尝试复制仍在运行/活动的数据库服务器,以接受来自用户的请求,例如插入和更新 我运行了下面提到的命令,开始将我的主服务器复制到复制服务器: root@replica:~#sudo -u postgres pg_basebackup -h [PRIMARY_IP] -D /var/lib/postgresql/12/main -U replication -P -v 备份过程没有错误,已经完成,但在尝试启动postgresql server时遇到如下错误 root@replica:~#ta

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

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

 root@replica:~#sudo -u postgres pg_basebackup -h [PRIMARY_IP] -D /var/lib/postgresql/12/main -U replication -P -v
备份过程没有错误,已经完成,但在尝试启动postgresql server时遇到如下错误

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
过程的情况下解决这个问题吗?因为我需要时间和带宽。

是的,我以前从未做过。我按照@jjane的建议,删除了以前的副本,然后运行:

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

是的,我以前从未做过。我按照@jjane的建议,删除了以前的副本,然后运行:

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

而且它还能工作。

我知道你没有在pg_basebackup中使用-R。那么你是如何设置流媒体的呢?最简单的解释是,您做得不对,将复制指向不同于备份的服务器。我发现您没有在pg_basebackup中使用-R。那么你是如何设置流媒体的呢?最简单的解释是,您做错了,将复制指向与备份不同的服务器。