Answer the question
In order to leave comments, you need to log in
How to correctly change the location of the postgresql-9.2.18.rl7 database?
Good afternoon, there was a problem with a lack of space in the partition, I connected a second disk, now I need to transfer the database to another partition, can you tell me how to transfer it correctly?
Thank you for understanding.
Answer the question
In order to leave comments, you need to log in
With a big downtime, but entirely on a new disk:
Extinguish the database, copy PGDATA (data_directory in the config) to a new location, replace the data_directory in the config with a new location, start the database.
By the way, you can not change the data_directory, but make a symlink. Postgresql doesn't mind following symlinks for its data.
With a small downtime, but with a slightly larger number of gestures:
using pg_basebackup, make a copy in a new location, launch a second postres instance with a replica there. When the replica catches up with the master, extinguish the master (by making a checkpoint), extinguish the replica (also with a checkpoint), replace the data_directory in the config with a new location, start the database.
Without downtime:
initialize the second disk as a tablespace, transfer to this tablespace what is in the way on the main one (try pg_repack, emnip can even transfer without a writing lock). Both disks will be used, which by the way is good from the point of view of io.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question