2017-09-14 124 views
2

我试图我的第一个Heroku的部署时遇到了问题Heroku的DB部署

heroku pg:backups:restore "https://s3.us-east-2.amazonaws.com/myusername/POSTGRESQL.dump" 
          DATABASE_URL --app MyAppName 

我收到错误

! An error occurred and the backup did not finish. 
! 
! pg_restore: [archiver] did not find magic string in file header 
! pg_restore finished with errors 
! waiting for download to complete 
! download finished with errors 
! please check the source URL and ensure it is publicly accessible 
! 
! Run heroku pg:backups:info r006 for more details. 

有时,错误的是:

Starting restore of https://s3.us-east-2.amazonaws.com/talXXXXXXXX to postgresql-XXXXXXXXX... done 

Use Ctrl-C at any time to stop monitoring progress; the ba 
Use heroku pg:backups to check progress. 
Stop a running restore with heroku pg:backups:cancel. 

Restoring... ! 
! An error occurred and the backup did not finish. 
! 
! waiting for restore to complete 
! pg_restore finished with errors 
! waiting for download to complete 
! download finished with errors 
! please check the source URL and ensure it is publicl 
! 
! Run heroku pg:backups:info r015 for more details. 

我已经从各种浏览器确认该URL可供公众访问,我可以下载该文件。按照推荐用于Windows的URL使用双引号,我做错了什么?

+0

如果我将网址修改为无效,我会得到相同的错误。所以它可能是因为它没有正确解析URL,因为公共可访问性是一个问题 – talkingtoaj

回答

0

最后,我无法工作,如何导入到Heroku的,因为他们做广告它可以做到在https://devcenter.heroku.com/articles/heroku-postgres-import-export#import

所以我用一个数据库连接的客户端一样DBeaver,转换我的数据库转储到一个SQL脚本,并手动运行脚本以导入数据。

:(

+0

嗨。你能更具体地了解你如何转换你的转储文件并运行脚本?我面临同样的问题。 – EGS

0

我面临同样的问题。转出它与我的转储文件的问题。我没有正确压缩它。

--format=c选择自定义的格式输出(这是与-Fc相同)它默认压缩文件,但它不够用,所以我也用--compress标志

这个标志告诉压缩的级别;它从0(较亮)变为9(较重)

我用9,以防万一,我的命令结束了这样的

pg_dump --format=c --compress=9 --no-acl --no-owner -h THE_HOST -U YOUR_USER THE_DATABASE > YOUR_FILE.dump 

和它的工作。