postgres replication without pg_basebackup? postgres 13.3

From: Pilar de Teodoro <pilar(dot)deteodoro(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: postgres replication without pg_basebackup? postgres 13.3
Date: 2022-11-07 10:02:46
Message-ID: CAH98rhHdZEhjhxsA8_Z_bZ+WvYtgHau8UgaZmVts9jg8NJ1H6Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Dear all,

We have a very large database of 37TB and we had to promote our standby to
primary due to some disk failures. Now the issues are solved, we would like
to make standby the old primary from a copy of the new primary which is
already in place. Is it possible without using pg_basebackup? We have
already a copy created than can be started but if we open as standby
(standby.signal created) the log says when started:

[2022-10-28 21:27:12 CEST-]LOG: starting PostgreSQL 13.3 on
x86_64-pc-linux-gnu, compiled by gcc (GCC) 8.5.0 20210514 (Red Hat
8.5.0-10), 64-bit

[2022-10-28 21:27:12 CEST-]LOG: listening on IPv4 address "0.0.0.0", port
8300

[2022-10-28 21:27:12 CEST-]LOG: could not create IPv6 socket for address
"::": Address family not supported by protocol

[2022-10-28 21:27:12 CEST-]LOG: listening on Unix socket
"/tmp/.s.PGSQL.8300"

[2022-10-28 21:27:12 CEST-]LOG: database system was interrupted; last
known up at 2022-10-28 20:31:08 CEST

[2022-10-28 21:28:06 CEST-]LOG: restored log file "00000003.history" from
archive

cp: cannot stat '/PostgresWalLogArchive/new/00000004.history': No such file
or directory

[2022-10-28 21:28:06 CEST-]LOG: entering standby mode

[2022-10-28 21:28:06 CEST-]LOG: restored log file "00000003.history" from
archive

cp: cannot stat '/PostgresWalLogArchive/new/000000030000BF720000002F': No
such file or directory

[2022-10-28 21:28:06 CEST-]LOG: restored log file
"000000020000BF720000002F" from archive

[2022-10-28 21:28:06 CEST-]FATAL: requested timeline 3 is not a child of
this server's history

*[2022-10-28 21:28:06 CEST-]DETAIL: Latest checkpoint is at BF72/2F0309C0
on timeline 2, but in the history of the requested timeline, the server
forked off from that timeline at B1D6/60000000.*

*[2022-10-28 21:28:06 CEST-]LOG: startup process (PID 1298266) exited with
exit code 1*

[2022-10-28 21:28:06 CEST-]LOG: aborting startup due to startup process
failure

[2022-10-28 21:28:07 CEST-]LOG: database system is shut down

Do you know if we can make it work without having to run pg_basebackup for
37TB which will take about 3 days to copy? Why it is requesting a different
timeline if it is a copy of the primary?

Primary replica parameters:

wal_level = replica

archive_mode = on

archive_command = 'cp -i %p /PostgresWalLogArchive/new/%f'

standby replica parameters:

primary_conninfo = 'host=XXX port=8300 user=postgres password=***'

restore_command = 'cp /PostgresWalLogArchive/new/%f %p'

archive_cleanup_command =
'/home/postgres/software/postgresql/bin/pg_archivecleanup
/PostgresWalLogArchive/new/%f %r'

Thank you very much for your help in advance.

Pilar de Teodoro

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Stefan Froehlich 2022-11-07 10:17:16 Re: server process (PID 2964738) was terminated by signal 11: Segmentation fault
Previous Message Kyotaro Horiguchi 2022-11-07 05:21:56 Re: AW: Reducing bandwidth usage of database replication