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 1kzeHX-0004wd-Cw for pgsql-admin@arkaria.postgresql.org; Wed, 13 Jan 2021 11:25:43 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kzeHV-0005ON-J5 for pgsql-admin@arkaria.postgresql.org; Wed, 13 Jan 2021 11:25:41 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kzeHV-0005OG-8f for pgsql-admin@lists.postgresql.org; Wed, 13 Jan 2021 11:25:41 +0000 Received: from mail-ed1-x52b.google.com ([2a00:1450:4864:20::52b]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kzeHQ-0006q2-OY for pgsql-admin@lists.postgresql.org; Wed, 13 Jan 2021 11:25:40 +0000 Received: by mail-ed1-x52b.google.com with SMTP id i24so1489509edj.8 for ; Wed, 13 Jan 2021 03:25:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20150623.gappssmtp.com; s=20150623; h=message-id:subject:from:to:date:in-reply-to:references:user-agent :mime-version:content-transfer-encoding; bh=LbYj5LDig4wma8c74AD8/2B71WoRSR+rWrGecGse8y0=; b=w/eh5moxU3ut4Y59wr0jqMN3xMGkvufwizQCyp8297Mj0zsJgRg69wkQYRuiUUpfjk X9F/AqNoXQN1Y5AgkEFrvaKBXoN+JSj0IPstaHRkECVAequI08Zid/lD74rtACa3LQBs nn/FzwEhKgMY/zUwjBBgx/OKo+Mto/j4MIq8wEbc1U1avQsIXmnbaoVUak4PdOGpV84P aTaEHu1Hl2z2KdKZ3uI+3X02vDdeBbp2qpU3rGS3KasWz7eOyIVEOK297bVRebMfZ0xR FXb6lISNywXtnbt3jAGHdQvj8sN2/L/OYOe+McQ+/9r1QFM6SIGaEyer1EZG7tYSQHB7 OHRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=LbYj5LDig4wma8c74AD8/2B71WoRSR+rWrGecGse8y0=; b=bMTQt/dyQlbOhnKnVEVg8W/btcpjDsyMTu4vJ1H3BkV5E8i286Gkw7JwDkRLxAiExL VnUa1k7L7gs2xkoHG4NrOYx6Hy+rWK1K0cQEZMxMi/eAZ0I5Uh0vcHA62huarHS0VL+Q 3JJmjyX1VzVUlrhpV7FEtwmOjvPkynUYfKia9nh/nvZgyssA6leqR7mZyjdJptIWyl5X 8fhz2h/AdV0Z+subIcNBsYoG8lojkUnviErrEzvL//EZEiLGEwEylmNTAnd8x/f+3CNh MbWIC0PAAOGNPq+1bBlDQZm7rFn5mCQNYAydpMXZAGtDAT7UuuupAxRpaUD0KPqyD4f+ DWjA== X-Gm-Message-State: AOAM532fIKYfzz1KDpxExnXj5EBCBAKdTdGrB3JgFgRkylpXvq6C/KcF GGgXkrH6Zh6yp0mmy1qPRzAc5g== X-Google-Smtp-Source: ABdhPJygITVr9oTOQYi8YtYqJdVKYRgu0LCxVo/E73gUNfylx77eoFkO3AgC68cbqdmgTBmpeE9UjA== X-Received: by 2002:aa7:d603:: with SMTP id c3mr1359314edr.337.1610537136022; Wed, 13 Jan 2021 03:25:36 -0800 (PST) Received: from localhost.localdomain (62-47-146-151.adsl.highway.telekom.at. [62.47.146.151]) by smtp.gmail.com with ESMTPSA id s1sm602922ejx.25.2021.01.13.03.25.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Jan 2021 03:25:35 -0800 (PST) Message-ID: <976875a5adf1c1cda0d55e6da0313f30dc8059f6.camel@cybertec.at> Subject: Re: PostgreSQL replication failover From: Laurenz Albe To: Jan Peters , pgsql-admin@lists.postgresql.org Date: Wed, 13 Jan 2021 12:25:35 +0100 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.5 (3.36.5-2.fc32) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Wed, 2021-01-13 at 09:27 +0100, Jan Peters wrote: > we are running postgresqlserver on s390 zLinux machines. The distribution > is RedHat 7 and RedHat 8, so we do not have the many x86 tools available. > > We always run 2 instances with a replication (streaming) async mode, the replica > is in hot_standby and we use it for read-only accesses. About the setup we have the following question: > > How is an orderly failover accomplished? Our current procedure is. > > 1. primary stop > 2. promote replica to primary > 3. create standby.signal on old primary > 4. change primary_conninfo on old primary > 5. start old primary as new replica > > Is this processing correct? Are there any other steps that simplify a failover? > How can we be sure that all changes have been transferred from the old master to the replica? What you describe is not a failover, but a switchover. If you shut down the primary server cleanly, all changes will be replicated, so you should be good. During a failover, that is, if the primary suddenly fails, there is always the possibility that you lose some transactions, unless you use synchronous replication. Yours, Laurenz Albe -- Cybertec | https://www.cybertec-postgresql.com