Postgresql database backup (and restore) from two servers to third storage place

backupclientpg-dumppostgresql

I have two server machines with PostgreSQL: (A) is version 9.0.15 and (B) version 9.2.
I wish to make backups of the databases stored in (A) and (B) – and be able to do restore if needed too! – to a 'storage' machine (C) where I have postgresql-commons clients installed (9.3).

Which is the cleanest/better way to obtain my goal?

I've made scripts on (C) to use pg_dump to make local backups from (A) and (B), but being a newer version I've problems with restore, also when using Plain sql format.

Do I need to install clients pg_dump/restore for 9.0 and 9.2 version on the client machine (C) and if so, how? thanks.

Best Answer

I would run the backup jobs on A and B at specified times using the local native pg_dump, then push them to C for storage.

sudo su -c 'pg_dump -f ~/backupfile.sql -C "MyDB"' myuserid
scp ~/backupfile.sql myuserid@cmachine.mydomain.com:

Restoring from the backup file can be done with:

psql -d <database> -f backup-file.sql