From: Jehan-Guillaume de Rorthais <jgdr@dalibo.com>
To: James Sewell <james.sewell@jirotech.com>
Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: Safe switchover
Date: Mon, 13 Jul 2020 18:52:08 +0200
Message-ID: <20200713185208.2f850d3e@firost> (raw)
In-Reply-To: <CAANVwEv6Ttv0p74P0U8DemFdYejC=VRX2xvFA-nPHTZk=v-12Q@mail.gmail.com>
References: <CAANVwEv6Ttv0p74P0U8DemFdYejC=VRX2xvFA-nPHTZk=v-12Q@mail.gmail.com>
On Fri, 10 Jul 2020 10:05:52 +1000
James Sewell <james.sewell@jirotech.com> wrote:
> Hi all,
>
> I’m trying to work out a procedure for a safe zero data loss switchover
> under (high) load, which allows the old master to be reconnected without
> the use of pgrewind.
>
> Would the following be sane?
>
> - open connection to database
> - smart shutdown master
> - terminate all other connections
> - wait for shutdown (archiving will finish)
> - Identify last archived WAL file name (ensure it’s on backup server.)
> - wait till a standby has applied this WAL
> - promote that standby
> - attach old master to new master
During graceful shutdown (smart or fast), the primary is waiting for standby to
catchup with replication before the full stop. But nothing will save you if the
designated standby disconnect by itself during the shutdown procedure.
I usually use:
- shutdown the primary
- use pg_controldata to check its last redo checkpoint
and/or use pg_waldump to find its shutdown checkpoint
- check logs on standby and replication status and make sure it received the
shutdown checkpoint (pg_waldump on the standby and/or last received lsn)
- promote the standby
- setup the old primary as standby
- start the old primary as new standby.
Regards,
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: jgdr@dalibo.com, james.sewell@jirotech.com
Subject: Re: Safe switchover
In-Reply-To: <20200713185208.2f850d3e@firost>
References: <CAANVwEv6Ttv0p74P0U8DemFdYejC=VRX2xvFA-nPHTZk=v-12Q@mail.gmail.com> <20200713185208.2f850d3e@firost>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox