![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitvsgr11X6_An6sLlaATBVVRTS9s0ViuPi7FsNQsCw889zS9dNDBDdgFxoCb7DAaLFVi9JQrp1-nLWkeBZd4GByOq_msjcVFrtRYGVmxZJAOZOQPk7q9jwlFc1n4pvQmUMvUI6Q6uUo28/s200/clone_remote_Database.png)
For projects involving small to medium sized databases one may require to copy the remote (or production) database onto local environment. I was earlier doing this for my production application using custom pg_dump and then restoring with pg_restore. It was relatively straightforward but still consumed good amount of time. I wanted to automate this using capistrano and this is how I did it
You should note that this is extremely fast because it executes the command on the VPS - usually EC2 which has amazing internet speeds. And then copies it over scp as a single file. You can also add a compression step using the --format option in the pg_dump.
Hope this was helpful!
Cheers!
Braga
No comments:
Post a Comment