Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iVXrE-0001Yb-EA for pgsql-admin@arkaria.postgresql.org; Fri, 15 Nov 2019 09:25:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iVXrC-0005Xb-Kl for pgsql-admin@arkaria.postgresql.org; Fri, 15 Nov 2019 09:25:34 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iVXrC-0005XS-7r for pgsql-admin@lists.postgresql.org; Fri, 15 Nov 2019 09:25:34 +0000 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1iVXr7-0003QQ-Ia for pgsql-admin@postgresql.org; Fri, 15 Nov 2019 09:25:33 +0000 Received: by mail-wm1-x32b.google.com with SMTP id q70so8911477wme.1 for ; Fri, 15 Nov 2019 01:25:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zunibal-com.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language; bh=umK+ZOUNuGEuMp4WvvN+q4x+IZDjWtNuCzFpcr6GNnU=; b=yeYm4iorJl/OCl/DN4HDE2LmflT0MBZnl8BlxjZpL2Bt59D9Y4cBS/mFTr8AzrKHZo guXD0kR21DRBDx0Jiy+wZ47JD/pKS1NdwxdCH8aSDjuSiAuL52D+zPSTIgOy3eNC72Uw 5q4aVsW1eCs0MkllriQyEN/F2SwsbomtTHSXVYS9l59+AaTrFV/HYbh+m+aT9rheEX0+ /iVN/xXBO6bzmDl3qMrotyynWT2CJLhZx3HjUIcAlAWDvuNhGDAVOyKwmJeWtiRb5kGA uOnTqQcZegZvX/maYX8CC0t0AwCuQl0kdC2AvuyEtwvv/zaMi5D1ps7OjPozQIvVIrvf lrAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=umK+ZOUNuGEuMp4WvvN+q4x+IZDjWtNuCzFpcr6GNnU=; b=g2QwJG2jASZqr0LGQrqrtHSwcNcNjUdx+oeoJBQT20H8mWOKOUkyDOyHZjx7HkQ6s3 f+r100i689qalO6d25qcB0M62gm0hgnMTWDDxh+heyeHFworJW34wbhqqbWARmK3CnOu gzAp1g2n/N4U7hXJszT/Ke/OHDaEKMsZmPex5I6wvn7qmNWwzovSIHhqXms9RnqU1uLN tojm09kPUQQQRK3G1kLHFn4g/japlXVoGmHwynkGpJhAsnVe6+2kp+Qw/cKtPyKG6vae MrfQMhS5z0oc7cn6RRAYLvU/ROZ7+/10HIOno6SXfGVVQBi8MmrNwDVvQB2Qh+QucULa bpOg== X-Gm-Message-State: APjAAAVJHUMPt39vVGNdTSNwABF7J8k1fzFVf9DGRtaW24caUuyGcCQ+ OM8xYXvMOn12doVhk2i2i+cvbq4WDJI= X-Google-Smtp-Source: APXvYqw8I/sTfHrHdjsWWPmCxSI0hab4UdcG59w1baWKNZvv98IH1wgZYZ1vDNc02khn+UepaPpXlg== X-Received: by 2002:a1c:60d7:: with SMTP id u206mr14060540wmb.101.1573809927918; Fri, 15 Nov 2019 01:25:27 -0800 (PST) Received: from [192.168.3.150] ([176.222.91.85]) by smtp.gmail.com with ESMTPSA id w17sm11320118wrt.45.2019.11.15.01.25.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 15 Nov 2019 01:25:27 -0800 (PST) Subject: Re: Strategy for upgrade highly used server To: Victor Yegorov Cc: pgsql-admin@postgresql.org References: <5ce6203a-78cb-25b0-3b91-65179aa280e0@zunibal.com> From: Ekaterina Amez Message-ID: Date: Fri, 15 Nov 2019 10:25:26 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------4205AB44174DBF8F39207690" Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------4205AB44174DBF8F39207690 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit El 11/11/19 a las 15:24, Victor Yegorov escribió: > пн, 11 нояб. 2019 г. в 11:13, Ekaterina Amez > >: > > I'm trying to upgrade all postgres servers at my work place. I've > began > with oldest versions moving them to newer ones, basically from > 8.4/9.2 > to 9.6. When all are in 9.6, I'll go with v10 and after that... > we'll see. > > > I would go to 11.6 straight away (11.6 will be available later this week). > By making intermediate stops you'll make total downtime bigger. I intended to have all database servers at the same version level, that's why I have chosen 9.6 (when I began with this task we had v7.4 in one of the servers, and now lower version in our database servers is 9.2). > > We are going to free some space in main_db moving old data to another > server (~90GB) and changing the app that uses it but this db grows > quite > fast and we'll be probably in the same size in a few months. > > I know that using --link would make pg_upgrade much faster but by now > we're not using it because we want to have the old version available > just in case newer one gives us any problem. > > > Before upgrading master DB, we always make sure that we have physical > replica, that is up to date. > Then we're free to use pg_upgrade in link mode. In any case, having > replica around for the major maintenance activities > is a good thing to do in any case. > > For the upgrade, typical procedure is: > - create a new cluster on the upgrade-to version (11) > - open configuration files of new and old cluster side by side and > transfer settings. >   Do not overwrite new configuration file, as it typically contains > quite some new options. >   By overwriting the config, you will not be able to “see” them. > - transfer pg_hba (and other) settings > - transfer any custom extensions/FTS dictionaries/etc. > - make sure pg_wal points to the right location, if you're using symlinks > - do a schema-only dump of the old cluster and try to load it into the > new cluster. >   If fails, correct errors, re-initdb new cluster and try again, till > schema loads fine. > - run pg_upgrade in the `--check` mode to make sure no surprises will > pop up during the upgrade >   (typical thing to remember — tablescpaces locations) > - perform the upgrade > > We've been using this procedure without issues for years. When you describe the upgrade procedure, do you mean upgrading the master or the slave? Do you promote server as master while upgrading original master? Let people access only to the replica in read-only mode while upgrading the master? > -- > Victor Yegorov --------------4205AB44174DBF8F39207690 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit


El 11/11/19 a las 15:24, Victor Yegorov escribió:
пн, 11 нояб. 2019 г. в 11:13, Ekaterina Amez <ekaterina.amez@zunibal.com>:
I'm trying to upgrade all postgres servers at my work place. I've began
with oldest versions moving them to newer ones, basically from 8.4/9.2
to 9.6. When all are in 9.6, I'll go with v10 and after that... we'll see.

I would go to 11.6 straight away (11.6 will be available later this week).
By making intermediate stops you'll make total downtime bigger.
 

I intended to have all database servers at the same version level, that's why I have chosen 9.6 (when I began with this task we had v7.4 in one of the servers, and now lower version in our database servers is 9.2).



We are going to free some space in main_db moving old data to another
server (~90GB) and changing the app that uses it but this db grows quite
fast and we'll be probably in the same size in a few months.

I know that using --link would make pg_upgrade much faster but by now
we're not using it because we want to have the old version available
just in case newer one gives us any problem.

Before upgrading master DB, we always make sure that we have physical replica, that is up to date.
Then we're free to use pg_upgrade in link mode. In any case, having replica around for the major maintenance activities
is a good thing to do in any case.

For the upgrade, typical procedure is:
- create a new cluster on the upgrade-to version (11)
- open configuration files of new and old cluster side by side and transfer settings.
  Do not overwrite new configuration file, as it typically contains quite some new options.
  By overwriting the config, you will not be able to “see” them.
- transfer pg_hba (and other) settings
- transfer any custom extensions/FTS dictionaries/etc.
- make sure pg_wal points to the right location, if you're using symlinks
- do a schema-only dump of the old cluster and try to load it into the new cluster.
  If fails, correct errors, re-initdb new cluster and try again, till schema loads fine.
- run pg_upgrade in the `--check` mode to make sure no surprises will pop up during the upgrade
  (typical thing to remember — tablescpaces locations)
- perform the upgrade

We've been using this procedure without issues for years.

When you describe the upgrade procedure, do you mean upgrading the master or the slave? Do you promote server as master while upgrading original master? Let people access only to the replica in read-only mode while upgrading the master?


--
Victor Yegorov
--------------4205AB44174DBF8F39207690--