Re: setting up postgres replication FATAL: database system identifier differs between the primary and standby

From: Noah <noah-list(at)enabled(dot)com>
To: pgsql-admin(at)lists(dot)postgresql(dot)org
Subject: Re: setting up postgres replication FATAL: database system identifier differs between the primary and standby
Date: 2022-02-13 02:02:29
Message-ID: 16326bbe-2efc-b27a-31d2-92021ff31a7c@enabled.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Hi,

On 2/12/22 5:03 PM, Ron wrote:
> On 2/12/22 6:35 PM, Ian Lawrence Barwick wrote:
> [snip]
>
>> You appear to be starting a database which is not a copy of the
>> primary node it
> binary copy
>> is trying to connect to. It's impossible to tell from the provided
>> information
>> how that happened. Possibly you have more than one instance on the
>> standby
>> (replica) and are somehow starting the wrong one. If not you'll need
>> to make
>> a backup of the primary and make sure that's what is being started.
>
> Binary copy using pg_basebackup (or something like pgbackrest).
>

Binary copy finally worked (the second time). Thanks for your assistance.

<host># rm -r /var/lib/postgresql/12/main
<host># sudo -u postgres mkdir /var/lib/postgresql/12/main
<host># sudo -u postgres chmod 700 /var/lib/postgresql/12/main
<host># sudo -u postgres pg_basebackup -h <ip> -p 5432 -U replication -D
/var/lib/postgresql/12/main/ -Fp -Xs -R
Password:
<host># sudo systemctl restart postgresql(at)12-main
<host>#

---- logs show ----
2022-02-13 01:58:32.445 UTC [264092] LOG: redo starts at 0/DA000028
2022-02-13 01:58:32.448 UTC [264092] LOG: consistent recovery state
reached at 0/DA000100
2022-02-13 01:58:32.448 UTC [264091] LOG: database system is ready to
accept read only connections
2022-02-13 01:58:32.464 UTC [264096] LOG: started streaming WAL from
primary at 0/DB000000 on timeline 1
---- snip ----

Cheers

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Avihai Shoham 2022-02-13 03:24:42 Re: PG_Basebackup create bad base.tar file
Previous Message Ron 2022-02-13 01:03:45 Re: setting up postgres replication FATAL: database system identifier differs between the primary and standby