pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedFrom: Laurenz Albe <laurenz.albe@cybertec.at>
To: Zwettler Markus (OIZ) <Markus.Zwettler@zuerich.ch>
To: pgsql-admin@lists.postgresql.org <pgsql-admin@lists.postgresql.org>
Subject: Re: promote a deferred standby without applying WALs
Date: Tue, 16 Jul 2024 10:40:55 +0200
Message-ID: <32b72ef82aba2e54a1eaaab248197a47091d675c.camel@cybertec.at> (raw)
In-Reply-To: <GV0P278MB009978C3836E51677017D2998BA22@GV0P278MB0099.CHEP278.PROD.OUTLOOK.COM>
References: <GV0P278MB009978C3836E51677017D2998BA22@GV0P278MB0099.CHEP278.PROD.OUTLOOK.COM>
On Tue, 2024-07-16 at 08:04 +0000, Zwettler Markus (OIZ) wrote:
> I have a standby database running 3 hours behind the primary (recovery_min_apply_delay = '3h').
>
> In case of a logical error on the primary I want to promote the standby database which still has correct data.
>
> The standby should not apply any more WAL in that case.
>
> It seems that this can only be done manually:
>
> 1. pg_ctl stop
> 2. rm -rf standby.signal
> 3. set primary_conninfo = ''
> 4. pg_ctl start
>
> Is there no single command on this?
I don't think there is a single command.
I would just set "recovery_target_time" to the appropriate time and reload.
Perhaps this could be the single command:
psql -c "ALTER SYSTEM SET recovery_target_time = '2024-07-16 12:00:00'" -c "SELECT pg_reload_conf()"
Yours,
Laurenz Albe
Attachments:
[application/pgp-signature] signature.asc (869B, ../32b72ef82aba2e54a1eaaab248197a47091d675c.camel@cybertec.at/2-signature.asc)
download
view thread (2+ messages)
Message-ID: <32b72ef82aba2e54a1eaaab248197a47091d675c.camel@cybertec.at>
Permalink: ../32b72ef82aba2e54a1eaaab248197a47091d675c.camel@cybertec.at/
Also on: postgresql.org/message-id/32b72ef82aba2e54a1eaaab248197a47091d675c.camel@cybertec.at
reply
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 using the --to and --cc options:
reply via email
To: pgsql-admin@postgresql.org
Cc: laurenz.albe@cybertec.at, Markus.Zwettler@zuerich.ch, pgsql-admin@lists.postgresql.org
Subject: Re: promote a deferred standby without applying WALs
In-Reply-To: <32b72ef82aba2e54a1eaaab248197a47091d675c.camel@cybertec.at>
* 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