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 1tIrau-00H8sg-Hn for pgsql-general@arkaria.postgresql.org; Wed, 04 Dec 2024 15:47:16 +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 1tIraq-000iqa-MZ for pgsql-general@arkaria.postgresql.org; Wed, 04 Dec 2024 15:47:13 +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 1tIraq-000iqS-7x for pgsql-general@lists.postgresql.org; Wed, 04 Dec 2024 15:47:13 +0000 Received: from mail-io1-xd2c.google.com ([2607:f8b0:4864:20::d2c]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1tIrao-0012BW-75 for pgsql-general@postgresql.org; Wed, 04 Dec 2024 15:47:12 +0000 Received: by mail-io1-xd2c.google.com with SMTP id ca18e2360f4ac-841a9c504d4so305473839f.0 for ; Wed, 04 Dec 2024 07:47:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733327229; x=1733932029; darn=postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=w6oocYdGp8SX2DLP0seMX1d6cq8AgY5pU+KKjQPatyU=; b=ciyRSB9N0Sf5F/sicQlSitMazymi3MIsMI1e66FgE2JtJrPqwInROXbuJPEgM8BnwA EGJY5piHrguX5OnFAvXn4/0jGcEUxFOE05X4gpjfvfmMIV4nxFXtGRrAa0aVruoiHdjA h6IpgE8tViSNud/APhwO1D+n7/ey50Vk35cgApwiVn4idCuq+AJRfdK5GSUU8J3EkEOh beL4x8HhVhU9yXUF7K/aUdeKwrrvx8rmMhLgsdx9+5gHXgjqW9OfAorga2OAJ4kvZhac RVnMsN9wwEa3HyPTys8ATMM0QhbaNzUFRfj7abvoel/XhFAaSJVM0ctk5Sk4R5t8rvD3 VsFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733327229; x=1733932029; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=w6oocYdGp8SX2DLP0seMX1d6cq8AgY5pU+KKjQPatyU=; b=ktr08iT1lJ439YkXTKVePhD75gtousEDKcNmP1pntNjr5zwsvxDfp6pPtG+AeZYMk6 yBu/6ijYPB+3GchpzoKsskQD1MfkTtGfz/dOn3DZ7+REZAzYKExFlOHx0bfBk3ulkXI0 rHIgxoCJ/dokboVdfSoTKG+0yV56pkf/UH6exEe2iLLWWCg9jpmQSrXbgd1UAZ9j1LaQ a/LTCDdrUeiuqmGxb8qvbcIbuNSVEq/WY3pzDOMg7yr8eJhu5qRBVkEVwRGj2GLBXJ2K RChuISETWxP7dZb7FFhmp/wnFGrOVRyV5N0MtEjffIa7Xkul0ahezWSvakxaLGml8ReN sf9Q== X-Forwarded-Encrypted: i=1; AJvYcCUog2VfR64K7nTEqaaJBdY5pcOSFvw5oWdrJKQ/FuM3Ri/V7cWNEpCaiL9LOdaZhSOHy1AJrvGcooJdkHh5@postgresql.org X-Gm-Message-State: AOJu0YxihsMoGfs2s4rkPnUtlSoA7Ok9HJwachhW3uj594iMxwJtgmlr rIrO4h6V7v9d85P2+LUQqSP6TUo71uoTms10/deWGTpLobCYCXyGpXLzLUP8NAdR5l+Au9Yx2zt QyY6IQPXjqUFUZse5nbgJJoWzR2Y= X-Gm-Gg: ASbGnctaFZGazWIF1XoFZQOsDEKtZecbyaAozdSaQaoQ/wUF2+QA0rIyb1VWjcO+cza lCv1yDUnCfX3mshlsP5+DxbcqRj/iJcM= X-Google-Smtp-Source: AGHT+IFVoDWmUjOisyIfp/Ptc2dGS3BCZj0by+wyvZT7k1EyM5jCtHuAJQKPNCLv8ZPZfN65AcrxMGDIvWR80jfd9Fw= X-Received: by 2002:a05:6602:1615:b0:83a:b52b:5cbb with SMTP id ca18e2360f4ac-8445b557a44mr835822739f.5.1733327228771; Wed, 04 Dec 2024 07:47:08 -0800 (PST) MIME-Version: 1.0 References: <0558ddd4d71641bdb41fa49b2425f73c@safrangroup.com> <98965993.3138805.1731699978332@mail.yahoo.com> <564950518.5117550.1733177884387@mail.yahoo.com> <07ab2d83-ffe5-4bec-9626-22a68f732579@aklaver.com> <273a88dc-4134-47d5-bc19-30ff5f97926c@aklaver.com> <498dfb34-4dd7-4f48-8188-355e1488d7e6@aklaver.com> <1061066336.5835157.1733316137292@mail.yahoo.com> In-Reply-To: <1061066336.5835157.1733316137292@mail.yahoo.com> From: Greg Sabino Mullane Date: Wed, 4 Dec 2024 10:46:32 -0500 Message-ID: Subject: Re: Help in vetting my steps for Postgres DB upgrade from Ver 13.X to ver 15.X To: Bharani SV-forum Cc: Ron Johnson , pgsql-general , Adrian Klaver Content-Type: multipart/alternative; boundary="000000000000c025f0062873b1a8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000c025f0062873b1a8 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Dec 4, 2024 at 7:42=E2=80=AFAM Bharani SV-forum wrote: > a) is the above said steps is correct with the given existing and propose= d > setup > No. Here are some steps: * Install Postgres on the new VM However you get it, use the newest version you can. As of this writing, it is Postgres 17.2. Version 15 is okay, but going to 17 now means a better Postgres today, and no worrying about replacing v15 in three years. * Create a new Postgres cluster On the new VM, use the initdb command to create a new data directory. Use the --data-checksums option * Start it up Adjust your postgresql.conf as needed Adjust your pg_hba.conf as needed Install any extensions used on the old VM Start the cluster using the pg_ctl command (or systemctl) * Test connection to the old vm from the new vm On the new vm, see if you can connect to the old one: psql -h oldvm -p 5432 --list You may need to adjust firewalls and pg_hba.conf on the old vm. * Copy the data Run this on the new VM, adjusting ports as needed: time pg_dumpall -h oldvm -p 5432 | psql -p 5432 Bonus points for doing this via screen/tmux to prevent interruptions * Generate new statistics and vacuum On the new vm, run: psql -c 'vacuum freeze' psql -c 'analyze' * Test your application * Setup all the other stuff (systemd integration, logrotate, cronjobs, etc.) as needed As Peter mentioned earlier, this can be done without disrupting anything, and is easy to test and debug. The exact steps may vary a little, as I'm not familiar with how Amazon Linux packages Postgres, but the basics are the same. Take it slow. Go through each of these steps one by one. If you get stuck or run into an issue, stop and solve it, reaching out to this list as necessary. Cheers, Greg --000000000000c025f0062873b1a8 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Wed, Dec 4, 2024 at 7= :42=E2=80=AFAM Bharani SV-forum <esteembsv-forum@yahoo.com> wrote:
a) is the abov= e said steps is correct with the given existing and proposed setup

No. Here are some steps:

* Install Postgres on the new VM
However you ge= t it, use the newest version you can. As of this writing, it is Postgres 17= .2. Version 15 is okay, but going to 17 now means a better Postgres today, = and no worrying about replacing v15 in three years.

* Create a new Postgres cluster
On the new VM, use the initdb c= ommand to create a new data directory.
Use the --data-checksums o= ption

* Start it up
Adjust your postgres= ql.conf as needed
Adjust your pg_hba.conf as needed
Ins= tall any extensions used on the old VM
Start the cluster using th= e pg_ctl command (or systemctl)

* Test connection = to the old vm from the new vm
On the new vm, see if you can conne= ct to the old one:
psql -h oldvm -p 5432 --list
Yo= u may need to adjust firewalls and pg_hba.conf on the old vm.

* Copy the data
Run this on the new VM, adjusti= ng ports as needed:
time pg_dumpall -h oldvm -p 5432 | psql -p 54= 32

Bonus points for doing this via screen/tmux to = prevent interruptions

* Generate new statistics an= d vacuum
On the new vm, run:
psql -c 'vacuum freeze= '
psql -c 'analyze'

* Test y= our application

* Setup all the other stuff (syste= md integration, logrotate, cronjobs, etc.) as needed

As Peter mentioned earlier, this can be done without disrupting anything= , and is easy to test and debug. The exact steps may vary a little, as I= 9;m not familiar with how Amazon Linux packages Postgres, but the basics ar= e the same.

Take it slow. Go through each of these= steps one by one. If you get stuck or run into an issue, stop and solve it= , reaching out to this list as necessary.

Cheers,<= /div>
Greg

--000000000000c025f0062873b1a8--