Re: Pause streaming replication - Mailing list pgsql-general

From Rita
Subject Re: Pause streaming replication
Date
Msg-id CAOF-Kfi7_YXDGCNcPKX_aRd1ikMLapKOooZbM0YTPZd9+CZcrA@mail.gmail.com
Whole thread Raw
In response to Re: Pause streaming replication  (Ben Chobot <bench@silentmedia.com>)
Responses Re: Pause streaming replication  (Ben Chobot <bench@silentmedia.com>)
Re: Pause streaming replication  (Michael Paquier <michael@paquier.xyz>)
Re: Pause streaming replication  (Laurenz Albe <laurenz.albe@cybertec.at>)
List pgsql-general
Yes, I have read the manual and seen this. It pauses the replication (select pg_is_wal_replay_paused()). But on the primary, when I look at pg_stat_replication, it still says 'streaming' in the state column. My question was how do I get it from 'streaming'  to anything else?  (https://www.postgresql.org/docs/11/monitoring-stats.html#PG-STAT-REPLICATION-VIEW) ?

I want to trigger an alert when 'streaming' isn't there. Or is there a better way to do it?

On Wed, Nov 10, 2021 at 7:24 PM Ben Chobot <bench@silentmedia.com> wrote:
Rita wrote on 11/10/21 1:25 PM:
> Hello.
>
> I am testing alerting on my primary and standby setup. I have async
> replication working but I would like to temporarily pause it so the
> value of 'state' isn't streaming. (select * from pg_stat_replication).
>
> How can I do that?

By reading the fine manual:
https://www.postgresql.org/docs/current/functions-admin.html#FUNCTIONS-RECOVERY-CONTROL-TABLE

The function you are looking for is pg_wal_replay_pause().


--
--- Get your facts first, then you can distort them as you please.--

pgsql-general by date:

Previous
From: Ben Chobot
Date:
Subject: Re: Pause streaming replication
Next
From: Ben Chobot
Date:
Subject: Re: Pause streaming replication