Re: PostgreSQL-12 replication failover, pg_rewind fails

From: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
To: Mariya(dot)Rampurawala(at)veritas(dot)com
Cc: pgsql-general(at)lists(dot)postgresql(dot)org, pgsql-general(at)postgresql(dot)org
Subject: Re: PostgreSQL-12 replication failover, pg_rewind fails
Date: 2020-05-12 08:45:07
Message-ID: 20200512.174507.1640068515388747886.horikyota.ntt@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello.

At Tue, 12 May 2020 06:32:30 +0000, Mariya Rampurawala <Mariya(dot)Rampurawala(at)veritas(dot)com> wrote in
> I am working on providing HA for replication, using automation scripts.
> My set up consists on two nodes, Master and Slave. When master fails, The slave is promoted to master. But when I try to re-register the old master as slave, the pg_rewind command fails. Details below.
...
> 1. Rewind again:
> 2. -bash-4.2$ /usr/pgsql-12/bin/pg_rewind -D /pg_mnt/pg-12/data --source-server="host=10.209.57.17 port=5432 user=postgres dbname=postgres"
>
> pg_rewind: servers diverged at WAL location 6/B9FFFFD8 on timeline 53
>
> pg_rewind: error: could not open file "/pg_mnt/pg-12/data/pg_wal/0000003500000006000000B9": No such file or directory
>
> pg_rewind: fatal: could not find previous WAL record at 6/B9FFFFD8
>
>
> I have tried this multiple times but always face the same error. Can someone help me resolve this?

As the error message is saying, required WAL file has been removed on
the old master. It is the normal behavior and described in the
documentation.

https://www.postgresql.org/docs/12/app-pgrewind.html

> but if the target cluster ran for a long time after the divergence,
> the old WAL files might no longer be present. In that case, they can
> be manually copied from the WAL archive to the pg_wal directory, or
> fetched on startup by configuring primary_conninfo or restore_command.

So you seem to need to restore the required WAL files from archive or
the current master.

regards.

--
Kyotaro Horiguchi
NTT Open Source Software Center

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Mariya Rampurawala 2020-05-12 09:40:18 Re: [EXTERNAL] Re: PostgreSQL-12 replication failover, pg_rewind fails
Previous Message Radoslav Nedyalkov 2020-05-12 08:27:17 Re: create index insist on 2 workers only