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 1qZxlw-007tud-5c for pgsql-admin@arkaria.postgresql.org; Sat, 26 Aug 2023 18:12:32 +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 1qZxlu-00C2N0-Cb for pgsql-admin@arkaria.postgresql.org; Sat, 26 Aug 2023 18:12:30 +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 1qZxlt-00C2Mg-Qo for pgsql-admin@lists.postgresql.org; Sat, 26 Aug 2023 18:12:29 +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 1qZxlp-001CNo-B5 for pgsql-admin@lists.postgresql.org; Sat, 26 Aug 2023 18:12:28 +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=4mxfbDw0MZ3fY/H68VyO3iPwVcm37IIGuBvu36lPOtQ=; b=VQCKJzuDigET28EXOUoR5bRnLw gLl6IgRkEL1zoPN5l7CzQKOy0HwpF2bXOUvSywO6oKRrR00vFDY3s7gLjQeFzgU54mmLyjojMFooe aCOHOBrEljxoal8retmV7sCqPXO0DxeN0/iUi8nYLGAPE507fOP949UA7wJAGB9FvxjQ=; Received: from vas by admin.sibptus.ru with local (Exim 4.95 (FreeBSD)) (envelope-from ) id 1qZxlm-000NkE-Nh for pgsql-admin@lists.postgresql.org; Sat, 26 Aug 2023 18:12:22 +0000 Date: Sat, 26 Aug 2023 18:12:22 +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 Georg H. wrote: > Hello Victor, > > > Am 25.08.2023 um 13:18 schrieb Victor Sudakov: > > Dear Colleagues, > > > > 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? > > > you may use patronictl pause + resume I would like to do the maintenance on one node only and keep the rest of the cluster functioning normally. > > keep in mind to set wal_keep_size (or wal_keep_segments depending on > your PG version high enough) I have written above about "unless the wal_keep_size value is unsanely high" :-) Keeping wal_keep_size very high is a waste of disk space and still provides no real guarantee, unfortunately. Why does Patroni use slots at all then? -- Victor Sudakov VAS4-RIPE http://vas.tomsk.ru/ 2:5005/49@fidonet