pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Paul Smith* <paul@pscs.co.uk>
To: pgsql-admin@lists.postgresql.org
Subject: Re: Postgres storage migration
Date: Fri, 8 Dec 2023 10:09:52 +0000
Message-ID: <20fd6e7a-73ff-4d15-a2e1-a44d5a4aa299@pscs.co.uk> (raw)
In-Reply-To: <CAJk5Ata3U1_BaLHiFoa31OkJ2RkmEuHxHWQi1gUNAqR_j-AS2Q@mail.gmail.com>
References: <CAJk5Ata3U1_BaLHiFoa31OkJ2RkmEuHxHWQi1gUNAqR_j-AS2Q@mail.gmail.com>

On 08/12/2023 09:43, Rajesh Kumar wrote:
> Hi
>
> We are using openshift environment and postgres version 15.2. We want 
> to change storage from ceph to local storage. So, Storage team made 
> default storage as local. Now, I created a new cluster with same 
> postgres version and I am planning to take backup from old cluster to 
> new cluster. Size is 100gb. Ram 24gb, cpu 2.
>
> My question is, is there a combination of pg_dump and pg_restore that 
> takes less time to complete the task?
>
> Last time it took more than 8hours. We were taking schema only dump 
> using dumpall . Then data only backup using pg_dump in directory format.

If you are using the same (major) version of PostgreSQL, you are moving 
the whole cluster, and can stop the services on both ends first, then 
you can:
- stop the services (both old and new)
- empty the data directory in the new location
- copy the whole data directory from the old location to the new 
location (using copy, rsync, scp, whatever)
- start the service on the new location

Obviously backup everything before doing anything destructive.

If you want to do it while the database is still running, then use 
replication and fail-over instead.

Paul






view thread (13+ messages)  latest in thread

Message-ID: <20fd6e7a-73ff-4d15-a2e1-a44d5a4aa299@pscs.co.uk>
Permalink:  ../20fd6e7a-73ff-4d15-a2e1-a44d5a4aa299@pscs.co.uk/
Also on:    postgresql.org/message-id/20fd6e7a-73ff-4d15-a2e1-a44d5a4aa299@pscs.co.uk

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: paul@pscs.co.uk, pgsql-admin@lists.postgresql.org
  Subject: Re: Postgres storage migration
  In-Reply-To: <20fd6e7a-73ff-4d15-a2e1-a44d5a4aa299@pscs.co.uk>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox