Rich_F
Rich_F

Reputation: 2056

pg_dump to Remote Server?

Is it possible to use pg_dump to backup to another server on the LAN?

pg_dump -U username dbname > [email protected]/users/rich/pg_backups/bkup-dbname.sql

So from a server to rich's workstation pg_backups directory? Is this doable or does rich need to pull the backup from his workstation?

Upvotes: 0

Views: 3285

Answers (1)

Hopping Bunny
Hopping Bunny

Reputation: 211

There are many ways to do this and here are a couple. Assuming you have ssh access to the remote host:

pg_dump -Fc myDb |ssh remoteHost 'cat >/tmp/dumpOfMyDb'

If you have the remote host mounted as an NFS share on your localhost, then you can just run:

pg_dump -d myDb -Fc -f /path/to/nfs/mount

Tip: -Fc has compression enabled.

Upvotes: 2

Related Questions