How to do pg_dump remotely

Asked

Viewed 951 times

2

I have a server on Amazon with small storage space, I need to back up on my personal machine.

if I log into the server and run

pg_dump -h localhost bd > backup.sql

everything works, however the backup is 700mb.

  • It is not better to generate the local backup (as you already do) and then transfer the file to your local machine by sftp?

  • solved your problem @Herick ?

1 answer

1


If you have postgresql installed on your machine (or the necessary files), you can execute the same command by changing the parameter -h by your server’s ip/domain on Amazon.

Noting that, may have direct access restriction to bank, routes, firewall, etc.

Me, I would back it up on the server, compress it (with protection), and send it to where I need it. The compressed dump will certainly get much smaller, and will still have protection, since it is plain text.

To test, I took a dump of 2.39 GB (2,574,549,841 bytes) and compactei, using the Winrar and optimal compression method. The result was a file of 845 MB (886,901,867 bytes).

Browser other questions tagged

You are not signed in. Login or sign up in order to post.