I need to copy all data from one Postgresql 9.2.4 server to another (both on similar hardware, Ubuntu 12.04). Is it safe to shut down the source Postgres server, rsync the data directory to the new server and start up both servers? Do I need to copy the pg_xlog directory as well? Or is it ok to leave that out since the source server will be shut down cleanly (service postgresql stop)?
I have approx 275G of data so don't want to backup and restore as that will take ages.
pg_dump -Fc
and pipe that over the network directly to apg_restore
, thus eliminating the need to save to disk. This is probably a less desirable way than using rsync though, as the latter at least allows you to restart if there is a network etc failure part way through.