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 1jtnix-00032Q-HG for pgsql-general@arkaria.postgresql.org; Fri, 10 Jul 2020 07:45:35 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jtniv-0000kD-Gq for pgsql-general@arkaria.postgresql.org; Fri, 10 Jul 2020 07:45:33 +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 1jtniv-0000k5-6L for pgsql-general@lists.postgresql.org; Fri, 10 Jul 2020 07:45:33 +0000 Received: from mail-ej1-x62c.google.com ([2a00:1450:4864:20::62c]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jtnir-00064E-NO for pgsql-general@lists.postgresql.org; Fri, 10 Jul 2020 07:45:32 +0000 Received: by mail-ej1-x62c.google.com with SMTP id o18so5012940eje.7 for ; Fri, 10 Jul 2020 00:45:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=IFLsNQKt3Py1y+Y87UUEveQRM0J/YwPQVsGTnVu5b3k=; b=SyNNTjNfLW+K3jLfQH8iGg2BDwudjgAy1gjFE4S+vmdnkQyd2n4nnliyMHmCrkgnZp 5Do3/VDQ90kqXlYLz3f10hr1c2dcZQ3C5lXzGeai+yXkIiDdsd/BKK8NSg1DJz5p5DAc Dp9H7HtFXS+3LrEyTl/kWhJvtPyVuQFR0ULjN0OtmofLnVkFrzqeP/1cct+SCCdU3vfS o8Ol+SzoVElyLFmUE0EeI3BnCEptuFN+WzTmB63/7EjTJ4x8mhJUT6eyDtVLZDaQNmXe JegNpUV/dUGZpjVHW3r7J9W2tlpyx0tSvN9fUKC/jyorWXJYMrZXbk4pqo0h71EVgsKK zpcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=IFLsNQKt3Py1y+Y87UUEveQRM0J/YwPQVsGTnVu5b3k=; b=oUFQA97zseGb1gzHTzMcI0BfMCM69Wt7Aj3l+vfplk8/0ua4Hoxp713lpqf8sflFK1 wjDnI9HGfTHV9KkxiAqwWu/GDBt6qftc/QZrWdyifKkmPKzu5c2koJX4NaYh/I9qCUEq jNxbZIAZAj/Ujogb+2MdkWK/UukF7llojgiunTgbpp+XXKFgsR2ZR/ef9MIaqh0HkGqt 9+MTOqZYuxPaLw8QrdWIP0E9eAvCmkzrmfBg+BML+a7tHlghmLUFhtCKS4yMwMuzmOIG D0eMFvfet+4E0Gt21Quh8qw5SI554aWvU8rlX/8Pl7g8+s2VP5pN5dh7d/vtKekmnEde rFBg== X-Gm-Message-State: AOAM5311f4RUuA8/fo+nuryr+B17wC6CwXTG979zSC1gF+6sUA81iqXq Ntl87z/hLlRWNAs5Wh6JpT8= X-Google-Smtp-Source: ABdhPJzK5teMKYNiWV+sDhR/g2C8HR3MtdeCpXp5dxbVyHNcmRlvGM6zM28hmbz5cJuzZTDgmfFFFA== X-Received: by 2002:a17:906:4b16:: with SMTP id y22mr60803891eju.4.1594367128588; Fri, 10 Jul 2020 00:45:28 -0700 (PDT) Received: from [192.168.1.8] (241-57-239-77.dyn.cable.fcom.ch. [77.239.57.241]) by smtp.gmail.com with ESMTPSA id q17sm3179617ejd.20.2020.07.10.00.45.28 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 10 Jul 2020 00:45:28 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.80.23.2.2\)) Subject: Re: Safe switchover From: =?utf-8?Q?Paul_F=C3=B6rster?= In-Reply-To: Date: Fri, 10 Jul 2020 09:45:27 +0200 Cc: "pgsql-generallists.postgresql.org" Content-Transfer-Encoding: quoted-printable Message-Id: <7E43945E-4571-4D30-9E8F-B940B9277DEF@gmail.com> References: To: James Sewell X-Mailer: Apple Mail (2.3608.80.23.2.2) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi James, I wouldn't work out the procedure myself, especially since there is a = free working solution already. It's dangerous if you do it yourself and = make a mistake. In our company, we rely on Patroni (https://github.com/zalando/patroni). = Yes, it uses pg_rewind in the background but it does switchover and = failover fast and reliably (also for high load databases), handles = timelines automatically and so on. For the DCS, we use etcd, but you can choose yourself, which one you = want. Cheers, Paul > On 10. Jul, 2020, at 09:18, James Sewell = wrote: >=20 >=20 > - open connection to database > - smart shutdown master > - terminate all other connections > - wait for shutdown (archiving will finish) >=20 > OK despite what it looked like from the code - upon testing it seems = like even a fast shutdown will wait for logs to be archived *as long as = progress is being made* (the same as smart). >=20 >=20 > The contents of this email are confidential and may be subject to = legal or professional privilege and copyright. No representation is made = that this email is free of viruses or other defects. If you have = received this communication in error, you may not copy or distribute any = part of it or otherwise disclose its contents to anyone. Please advise = the sender of your incorrect receipt of this correspondence.