Download & Restore Database (Multiple issues/questions)

1
We have a requirement where we have to download and restore our database periodically for various reasons. I tried writing a bash script for the first part of this requirement, the downloading of the snapshot. I'm using the Mendix Deploy API and get a list of snapshots, thereafter getting the download links for the latest snapshot. This is where it gets weird though. When trying to download the backup using the URL, it starts and finishes almost instantaneously. It's as if only the first chunk of data is downloaded. When I try to rerun the command, I get a 404 Not Found error. I tried both curl and wget on both my Mac and a Linux server. Both exhibit the same behavior, and no matter which options I try running the command with, I don't seem to have any luck. Has anyone had this issue before, or know what my problem could be? Now onto the restore. I downloaded a full backup via the front end, and tried restoring it to a remote Postgres database running on AWS. My app uses Postgres 9.6, and I'm trying to restore it to a 9.6 database. I keep getting errors though. I've used pgAdmin with varied success in the past, but I want to do this via command line. I unarchive the .tar.gz file I got from the download, and use the db.backup file inside the db directory to restore. Using pg_restore seems to be my only option if I understand the Postgres documentation correctly. Below is the command I ran:     pg_restore -c -C -h<url> -U<username> -p<port> -W -d<db_name> db.backup I've tried with and without "-C", with and without "-1", and a few other variations. Nothing seems to work. I keep getting errors about db roles and auth issues. Again, does anyone have any advice on this issue? Thanks in advance!  
asked
2 answers
0

Hi,

Regarding your second question about restoring the db. Try to first get it working with PgAdmin. When pgAdmin runs the restore you can see the command it used to do it with all the arguments. Then you can use the same command do it without pgAdmin.

I am not sure why it would not be possible to download a backup like that...

-Andrej
 

answered
0

The Backup API is not there yet. It is coming (I already did see some of the documentation pop up on Github). So the release seems imminant. When that is in place you can do al kinds of stuff. I already created an automatic deployment app but without the backup part it is still useless.

Regards,

Ronald

 

 

answered