Re: Postgres storage migration

From: Ron Johnson <ronljohnsonjr(at)gmail(dot)com>
To: Rajesh Kumar <rajeshkumar(dot)dba09(at)gmail(dot)com>
Cc: "Paul Smith*" <paul(at)pscs(dot)co(dot)uk>, Pgsql-admin <pgsql-admin(at)lists(dot)postgresql(dot)org>
Subject: Re: Postgres storage migration
Date: 2023-12-08 13:03:34
Message-ID: CANzqJaDohZsp0+bKn1dS_6W3jwYhJ8_ymaevywAWer-wA-T7FA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Postgresql "data files" do not store their directory locations. Move
$PGDATA anywhere you want *as long as the instance is stopped*.

On Fri, Dec 8, 2023 at 7:52 AM Rajesh Kumar <rajeshkumar(dot)dba09(at)gmail(dot)com>
wrote:

> In this case , basebackup is not required? Just rsync the directory
> /pgdata/pg15 ? I have one master and one replica.
>
> On Fri, 8 Dec 2023, 15:45 Paul Smith*, <paul(at)pscs(dot)co(dot)uk> wrote:
>
>> 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
>>
>>
>>
>>

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message ROHIT SACHDEVA 2023-12-08 13:59:56 Re: Related to Foreign Table Accessing
Previous Message Rajesh Kumar 2023-12-08 12:37:34 Re: Postgres storage migration