How to make a remote backup of Postgresql by saving the file on my machine?

Asked

Viewed 26 times

0

I have a machine that I need to backup the Postgresql database, it is in a Docker container on a server, to backup tried the following script:

docker exec -t postgresDB pg_dump -U usuario_banco -h remote_host --host=127.0.0.1 --port=5432 nome_do_banco --file=/etc/backup.bkp

The problem that is the bank is large and lack space for backup, I wonder if there is any way to save direct on my machine.

1 answer

0

You can use docker exec -v {fora_do_container: dentro_do_container}.

The -v serves to create a volume within the host Docker, where you can save the database files and it is not deleted if you delete the container.

  • fora_do_container: path to the folder to be saved outside the container
  • dentro_do_container: path to the folder that will be saved

Browser other questions tagged

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