Re: Move database - Mailing list pgsql-admin

From Paul Förster
Subject Re: Move database
Date
Msg-id A631D97B-6644-4935-849A-F4E8E57C6F31@gmail.com
Whole thread Raw
In response to Move database  (Yambu <hyambu@gmail.com>)
Responses Re: Move database
List pgsql-admin
Hi Yambu,

> On 10. Nov, 2020, at 14:48, Yambu <hyambu@gmail.com> wrote:
> What is the best way to move a database from one VM to another without losing records from updating applications?

I assume you want to minimize down time? If so, set up a streaming replication on the new VM and let PostgreSQL copy
thewhole database over by itself as a standby database. After copying is finished and both databases are completely in
sync,then shut down the old (primary) database and promote the standby database. After that, you can delete the old
database.

Assuming you can afford the down time, there is always the option of shutting the database down and scp or rsync it to
thenew VM and start it there. 

If you run it on some external storage like mounted NFS filesystems, you can shut it down, umount the NFS volume(s) on
theold VM, mount the NFS volume(s) on the new VM and start it there. 

It really depends on your system (storage) architecture.

Cheers,
Paul


pgsql-admin by date:

Previous
From: Yambu
Date:
Subject: Move database
Next
From: Ron
Date:
Subject: Re: Move database