Rita wrote on 11/10/21 5:36 PM:
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?
Oh yes, I'm sorry. I see now that was your original question, and my
suggestion doesn't help you there.
But I would say that, in my experience with monitoring streaming
replication, I haven't cared so much about if the replica is streaming
vs. rebuilding, but rather how far behind it has fallen when it is
supposedly streaming. Pausing replication lets you see what it will look
like when a disk failure blocks your replica's writes, or client
activity blocks wal replay, which are absolutely situations you want to
monitor for.