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 1iVXfz-00019W-2r for pgsql-admin@arkaria.postgresql.org; Fri, 15 Nov 2019 09:13:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iVXfx-0002mk-TQ for pgsql-admin@arkaria.postgresql.org; Fri, 15 Nov 2019 09:13:57 +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 1iVXfx-0002k1-Ci for pgsql-admin@lists.postgresql.org; Fri, 15 Nov 2019 09:13:57 +0000 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1iVXfp-0003Kv-4Y for pgsql-admin@lists.postgresql.org; Fri, 15 Nov 2019 09:13:51 +0000 Received: by mail-wr1-x42b.google.com with SMTP id n1so10080095wra.10 for ; Fri, 15 Nov 2019 01:13:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zunibal-com.20150623.gappssmtp.com; s=20150623; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language; bh=firyNWDwZBJy1K5DJ9M3a/qns0jdm4Wf1i8L3sKw/zU=; b=hBr5sE1KP8VJVqY32VbLNBgrN+3E8RriCtgB1vWqHfbe8ex7SzEFboiXdALoSPDM12 1WtTjOOqDgX+9uueX7PRDLZhrPoCeySJX1UDVFLnx7d30luuMP718yh9DBxuhdHggvn/ Cxb9gvhVk5dCyhuf+FRmiHwNrtMl7OS0ln3vSP2F7kKPDFOmV3LX4HmgBL7wgCbr88E1 glEFLc1BOX6sKAaOzw/GMIyiuDAzjbvVuu26Qmrl9IjV/94hmKV1cpt5DrdcABBiL1iX hWNJhQXLY3rj7Ye5vtzjTQVW011JwTrDX/bx+TAX02pLvJUX2G2XbJmeG7jT2uoSv4ae uiag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=firyNWDwZBJy1K5DJ9M3a/qns0jdm4Wf1i8L3sKw/zU=; b=Tr85q1oj9icidCli70JTC3XQoLikonWRkYqSl/qCELQ9uXZyfuCtXNNo6A5uoNVucE sflzw27o4yK2XJuBtAsLReHZprxy7twysaGkuCKHGyjPLP2DFA5H4h0suZbv+P20qWb0 /2J4txlIn96un8BFKMbiynMSIzkDGHqVZr2+OWoeZgQQSHIC4gFhNf08W1jM+893Ap6C RCnYQy5VAIhN9FeoG3ryvSb4m8tKQAV36oSP9rf1bzoaZBBqL5anI9OcgXQuP2+ayC3H hHYXckoKrlNf1Cbjr9xUtpaaVJ+Rraux4s6faGXqm2NWBE0mvkaUnOzNL90H5LUuFii7 Lvog== X-Gm-Message-State: APjAAAWWE9gnVbc4zgBV1uDUxEyewJrGYZiLG8TVIULSOU8fWqnfb6DV jlrcmWq2Js6KW+F6qAdNBX/RXRzqV/Q= X-Google-Smtp-Source: APXvYqzq5DSLrOjY6airMfTNCZb4JUjI8w+ebSKlmxbbYoWyfQWhtLXJt6z23wvu3nqKb+PVlNJOQA== X-Received: by 2002:a5d:65c4:: with SMTP id e4mr6218327wrw.269.1573809223192; Fri, 15 Nov 2019 01:13:43 -0800 (PST) Received: from [192.168.3.150] ([176.222.91.85]) by smtp.gmail.com with ESMTPSA id w4sm10517607wrs.1.2019.11.15.01.13.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 15 Nov 2019 01:13:42 -0800 (PST) Subject: Re: Strategy for upgrade highly used server To: =?UTF-8?Q?M=c3=b3nica_Gamarra?= , pgsql-admin@lists.postgresql.org References: <5ce6203a-78cb-25b0-3b91-65179aa280e0@zunibal.com> From: Ekaterina Amez Message-ID: <42f0c04c-efeb-3388-7489-8dbfb75a3ca4@zunibal.com> Date: Fri, 15 Nov 2019 10:13:41 +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="------------857CE6E8E9B87410EB4050DE" 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. --------------857CE6E8E9B87410EB4050DE Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Hi Monica, Please, remember to answer to the list or your answer will be only available to me. El 11/11/19 a las 14:37, Mónica Gamarra escribió: > You say ... > 1 -  we want to have the old version available  just in case newer one > gives us any problem. > And also > 2 - This server has problems with free disk space > And > 3 -  And the database needs to be up almost 24x7 (please describe > ALMOST in hours/min/sec and > indicate if it applies to all dbs) > > 1 and 2 are not compatible for your task. If you can't solve 2 you've > only have pg_upgrade, so, you > will lose old version. Using pg_upgrade it's possible to have old and new postgres versions running. You only need minor reconfiguration. Of course, this is only possible if the --link option is not used, which is the option that needs less disk space. > > I you can solve 2  as  you need old version you must have double the > space of PG_DATA. > > You have to decide this before building a plan. > > Talking about 3, all dba's here this, negotiate. > > Your timeline depends on   main_db  (332 GB). You have to test > pg_upgrade time for this database > in a similar server, and also test pd_dump/pg_restore. Testing before any change in production environment is a must, always. > > IF databases are not related ... and only in this case you have > another option that is install new version > and migrate or upgrade bid database first and then add databases db1 > to db7  (pg_dump/pg_restore) > one by one to new version (with this you minimize the amount of disk > space you need  for pg_upgrade > and downtime). I've used this strategy before, when upgrading other servers with databases without the almost-no-downtime needs. > > Choices. > A) all with pg_upgrade > - less space needed > - NO old version Wrong: this is only true if --link option is used. All the servers I've upgraded by now have both versions available, though the old one is down most of the time. > > B) pg_dump/pg_restore > - you need double disk space > - you will have to versions > - more downtime needed (you need to test it no know how much) > > C) A combination of both - ONLY for desperates > [ dump databases db1 to db7,  delete databases  db1 to db7 from old > version,  pg_upgrade  main_db, pg_restore db1 to db 7 ] > - less space needed > - NO old version > - less downtime for main_db > > You have to TEST all plans before. > > Good luck! Thank you for the schematic summary of this options (I' already knew). You've commented anything about replication option though. > > -- > /............................................ > Mónica Gamarra Barrios > monica.gamarra@gmail.com / --------------857CE6E8E9B87410EB4050DE Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit

Hi Monica,

Please, remember to answer to the list or your answer will be only available to me.

El 11/11/19 a las 14:37, Mónica Gamarra escribió:
You say ...
1 -  we want to have the old version available  just in case newer one gives us any problem.
And also 
2 - This server has problems with free disk space 
And 
3 -  And the database needs to be up almost 24x7 (please describe ALMOST in hours/min/sec and
indicate if it applies to all dbs)

1 and 2 are not compatible for your task. If you can't solve 2 you've only have pg_upgrade, so, you 
will lose old version.

Using pg_upgrade it's possible to have old and new postgres versions running. You only need minor reconfiguration. Of course, this is only possible if the --link option is not used, which is the option that needs less disk space.



I you can solve 2  as  you need old version you must have double the space of PG_DATA.

You have to decide this before building a plan.

Talking about 3, all dba's here this, negotiate.

Your timeline depends on   main_db  (332 GB). You have to test pg_upgrade time for this database
in a similar server, and also test pd_dump/pg_restore.

Testing before any change in production environment is a must, always.



IF databases are not related ... and only in this case you have another option that is install new version
and migrate or upgrade bid database first and then add  databases db1 to db7  (pg_dump/pg_restore) 
one by one to new version (with this you minimize the amount of disk space you need  for pg_upgrade 
and downtime).

I've used this strategy before, when upgrading other servers with databases without the almost-no-downtime needs.



Choices.
A) all with pg_upgrade 
- less space needed
- NO old version
Wrong: this is only true if --link option is used. All the servers I've upgraded by now have both versions available, though the old one is down most of the time.

B) pg_dump/pg_restore
- you need double disk space 
- you will have to versions
- more downtime needed (you need to test it no know how much)

C) A combination of both - ONLY for desperates
[ dump databases db1 to db7,  delete databases  db1 to db7 from old version,  pg_upgrade  main_db, pg_restore db1 to db 7 ]
- less space needed
- NO old version
- less downtime for main_db

You have to TEST all plans before.

Good luck!

Thank you for the schematic summary of this options (I' already knew). You've commented anything about replication option though.



--
............................................
Mónica Gamarra Barrios
monica.gamarra@gmail.com
--------------857CE6E8E9B87410EB4050DE--