Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qaSFO-009IUY-Cq for pgsql-admin@arkaria.postgresql.org; Mon, 28 Aug 2023 02:44:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qaSFM-005zxW-9L for pgsql-admin@arkaria.postgresql.org; Mon, 28 Aug 2023 02:44:56 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qaSFL-005zwr-JA for pgsql-admin@lists.postgresql.org; Mon, 28 Aug 2023 02:44:55 +0000 Received: from admin.sibptus.ru ([2001:19f0:5001:21dc::10]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qaSFH-001Rbt-1e for pgsql-admin@lists.postgresql.org; Mon, 28 Aug 2023 02:44:54 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sibptus.ru; s=20181118; h=In-Reply-To:Message-ID:Subject:To:From:Date; bh=fI30Gk/TpvJ9EBm7Et5knlo7Gnbv1PXo26RaAFNUUfE=; b=JpfC9AMPVPPBS9rd0zSTbycRzA xPgVO0bSFQMP5Txqne2bokxTQj/sv++uo4Wp2V2r8U7mrkDT4dGqfmxmGzoIFtJh84kyoQ7sEB7ds EZptTjeLL4nDMaqJ//gSNTga/sHoy+0mry22LT4HknuA0dyG079lP8Eu1JSkPuOreSQg=; Received: from vas by admin.sibptus.ru with local (Exim 4.95 (FreeBSD)) (envelope-from ) id 1qaSFE-0008vG-PJ for pgsql-admin@lists.postgresql.org; Mon, 28 Aug 2023 02:44:48 +0000 Date: Mon, 28 Aug 2023 02:44:48 +0000 From: Victor Sudakov To: pgsql-admin@lists.postgresql.org Subject: Re: Temporary disabling a replica in a Patroni cluster Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-PGP-Key: http://admin.sibptus.ru/~vas/ X-PGP-Fingerprint: 10E3 1171 1273 E007 C2E9 3532 0DA4 F259 9B5E C634 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Victor Sudakov wrote: > > Do you perchance know what is the correct procedure of temporarily > taking down a replica in a Patroni cluster, e.g. for 5-10 minutes of > hardware maintenance? > > The problem is that after stopping the patroni process (service) on a > replica, patroni removes the corresponding physical replication slot > from the leader, and unless the wal_keep_size value is unsanely high, > the replica, when up again, cannot restart streaming because the WAL > segments are already gone from the leader. > > Well, you all know: > <%%%>LOG: started streaming WAL from primary at B4A0/E2000000 on timeline 8 > <%%%>FATAL: could not receive data from WAL stream: ERROR: requested WAL segment 000000080000B4A0000000E2 has already been removed > <%%%>LOG: waiting for WAL to become available at B4A0/E2002000 > > Do you think there is a way to tell Patroni that a replica is down > temporarily and its replication slot should not be removed? > > Or, what am I missing? As WAL archiving (wal-g) is enabled in this cluster anyway, do you think adding "postgresql.parameters.restore_command" to the Patroni config will help in this situation? restore_command works very well in regular Postgres clusters catching up from a big replication delay and permits to have wal_keep_size=0, however does anyone know if there are any Patroni-specific reasons not to use restore_command under Patroni? -- Victor Sudakov VAS4-RIPE http://vas.tomsk.ru/ 2:5005/49@fidonet