【问题标题】:Can't import to Heroku Postgres with aws无法使用 aws 导入 Heroku Postgres
【发布时间】:2019-11-26 00:34:16
【问题描述】:
C:\Users\krishnava\Downloads\git>heroku pg:backups:restore "https://s3.amazonaws.com/backup_xxx"

DATABASE_URL !警告:破坏性行为 !此命令将影响应用 gcesalem !要继续,请键入 gcesalem 或使用 --confirm appname 重新运行此命令

> appname
Starting restore of https://s3.amazonaws.com/backup_xxx

到 postgresql-round-xxx... 完成

Use Ctrl-C at any time to stop monitoring progress; the backup will continue restoring.
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 publicly accessible
 !
 !    Run heroku pg:backups:info r006 for more details.

信息

 C:\Users\krishnava\Downloads\git>heroku pg:backups:info r006
 === Backup r006
 Database:         BACKUP
 Started at:       2019-07-16 15:34:40 +0000
 Finished at:      2019-07-16 15:34:40 +0000
 Status:           Failed
 Type:             Manual
 Backup Size:      0.00B (0% compression)
 
 === Backup Logs
 2019-07-16 15:34:40 +0000 pg_restore: [archiver] did not find magic string in file header
 2019-07-16 15:34:40 +0000 waiting for restore to complete
 2019-07-16 15:34:40 +0000 pg_restore finished with errors
 2019-07-16 15:34:40 +0000 waiting for download to complete
 2019-07-16 15:34:40 +0000 download finished with errors
 2019-07-16 15:34:40 +0000 please check the source URL and ensure it is publicly accessible- - 

【问题讨论】:

标签: postgresql amazon-web-services heroku


【解决方案1】:

您可以导出本地数据库的副本并将其导入 Heroku,而不是这样做。

对于从本地数据库导出,

pg_dump <DATABASE_NAME> > <FILENAME>.sql 

这将要求您输入数据库密码。但在 Windows 中,这会询问用户密码,因为默认用户名是系统用户名。为此,您必须指定您的用户名

pg_dump -U <USER_NAME> <DATABASE_NAME> > <FILENAME>.sql 

对于您的情况,命令将如下所示:

pg_dump -U postgres gce > gce.sql 

本地数据库导出后,可以直接上传到heruko。

heroku pg:psql --app <APP_NAME> < gce.sql

【讨论】:

    猜你喜欢
    • 2021-01-11
    • 2015-05-16
    • 2012-06-21
    • 2023-03-14
    • 2018-08-06
    • 2017-08-31
    • 1970-01-01
    • 1970-01-01
    • 2019-12-12
    相关资源
    最近更新 更多