Moving a PostgreSQL database from one server to another

Joe Conway mail at joeconway.com
Thu Jan 13 20:19:53 UTC 2005


Edward Croft wrote:
> On Thu, 2005-01-13 at 11:28 -0600, Rodolfo J. Paiz wrote:
>><SNIP>
>>I guess I need a backup/restore or an export/import... but for some

> I do this all the time. Postgres stores its data files
> in /var/lib/pgsql/data by default. Stop the server on your laptop. This
> will close the files. You can then copy that whole directory over. As
> long as you install into the same directory, you should be able to just
> restart postgres. You may need to make changes to the pg_hba.conf and
> pg_ident.conf. 
> 

A couple of safety tips worth mentioning on the above procedure:
1. Make sure the directory/files on the new server are still owned by
    the database user -- usually postgres.
2. This will only work if the hardware architecture (i.e. i686 versus
    x86_64) and database version (e.g. 7.4.x) is the same on the two
    machines.

HTH,

Joe




More information about the fedora-list mailing list