Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mkzFK-0003sO-MN for pgsql-general@arkaria.postgresql.org; Thu, 11 Nov 2021 01:51:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mkzFI-0007gN-TE for pgsql-general@arkaria.postgresql.org; Thu, 11 Nov 2021 01:51:20 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mkzFI-0007gE-Cp for pgsql-general@lists.postgresql.org; Thu, 11 Nov 2021 01:51:20 +0000 Received: from dog.birch.relay.mailchannels.net ([23.83.209.48]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mkzFF-0002S3-IN for pgsql-general@postgresql.org; Thu, 11 Nov 2021 01:51:19 +0000 X-Sender-Id: a2hosting|x-authuser|bench@silentmedia.com Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 2AD46401831; Thu, 11 Nov 2021 01:51:15 +0000 (UTC) Received: from a2ss24.a2hosting.com (100-96-11-115.trex.outbound.svc.cluster.local [100.96.11.115]) (Authenticated sender: a2hosting) by relay.mailchannels.net (Postfix) with ESMTPA id 7B5BA401A71; Thu, 11 Nov 2021 01:51:14 +0000 (UTC) X-Sender-Id: a2hosting|x-authuser|bench@silentmedia.com Received: from a2ss24.a2hosting.com (a2ss24.a2hosting.com [75.98.175.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384) by 100.96.11.115 (trex/6.4.3); Thu, 11 Nov 2021 01:51:15 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: a2hosting|x-authuser|bench@silentmedia.com X-MailChannels-Auth-Id: a2hosting X-Fumbling-Cooing: 343e421a4024275a_1636595474896_651405803 X-MC-Loop-Signature: 1636595474896:3269830698 X-MC-Ingress-Time: 1636595474896 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=silentmedia.com; s=default; h=Content-Type:In-Reply-To:MIME-Version:Date: Message-ID:From:References:Cc:To:Subject:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=YZEe5YBVODj8HMz0Qg1WQtlWQ2ElldFaes9AyXf8x9k=; b=ld6aQrAXAWfHuQ8qj4i7TK2ELX HKM30LUkpD+666eiFz9S4j5Ez+b+ECilMqqzI9vm9MIvoMg6otijGaeAEFeDpc95e0ZyGuw6rPr5G tiq0km1dgJ+ZJAcjqekZFSChF+sIQJO4Hd/e308bStoMLU2CH/E00DeAcwbgB1v0CNJJ4NZCG419i Yw19nYg1wcAa7Gc8JrOqP+6+/d4+fTYWTSEP31tW6YrMOnPyH06iAznToaV1vdzarIlpnjouYhq92 eZqikmFwVLB1YN6GPHwHi05nApwIYBBZkl/CwRrUePpC+5Z9NWYQ7pmK1OVXEEQSyw/ZHA73rEk4I sFGlNzog==; Received: from 97-113-88-109.tukw.qwest.net ([97.113.88.109]:53108 helo=Rolo.local) by a2ss24.a2hosting.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1mkzFB-0014Sk-G0; Wed, 10 Nov 2021 20:51:13 -0500 Subject: Re: Pause streaming replication To: Rita Cc: "pgsql-general@postgresql.org >> PG-General Mailing List" References: <476bcc51-c1e4-1fb1-24c6-07cd5f6d5d80@silentmedia.com> From: Ben Chobot Message-ID: <2b7b26f6-d00b-edad-7ea6-160c699219d3@silentmedia.com> Date: Wed, 10 Nov 2021 17:51:11 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:52.0) Gecko/20100101 PostboxApp/7.0.51 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------1C2C5C8F0A35B57BE21F1B1C" Content-Language: en-US X-AuthUser: bench@silentmedia.com List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------1C2C5C8F0A35B57BE21F1B1C Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit 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. --------------1C2C5C8F0A35B57BE21F1B1C Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit 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.

--------------1C2C5C8F0A35B57BE21F1B1C--