AW: [Extern] Re: promote a deferred standby without applying WALs

From: "Zwettler Markus (OIZ)" <Markus(dot)Zwettler(at)zuerich(dot)ch>
To: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, "pgsql-admin(at)lists(dot)postgresql(dot)org" <pgsql-admin(at)lists(dot)postgresql(dot)org>
Subject: AW: [Extern] Re: promote a deferred standby without applying WALs
Date: 2024-07-16 09:01:43
Message-ID: GV0P278MB00997C9B2132DA81AE97EEC48BA22@GV0P278MB0099.CHEP278.PROD.OUTLOOK.COM
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

> -----Ursprüngliche Nachricht-----
> Von: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
> Gesendet: Dienstag, 16. Juli 2024 10:41
> An: Zwettler Markus (OIZ) <Markus(dot)Zwettler(at)zuerich(dot)ch>; pgsql-
> admin(at)lists(dot)postgresql(dot)org
> Betreff: [Extern] Re: promote a deferred standby without applying WALs
>
> 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

setting recovery_target_time + reload would be step 0 in that case, before stop/start. correct?

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Laurenz Albe 2024-07-16 09:21:32 Re: AW: [Extern] Re: promote a deferred standby without applying WALs
Previous Message Laurenz Albe 2024-07-16 08:40:55 Re: promote a deferred standby without applying WALs