【问题标题】:Why my local PostgreSQL database push to my Heroku Postgres doesn't work?为什么我的本地 PostgreSQL 数据库推送到我的 Heroku Postgres 不起作用?
【发布时间】:2021-10-27 12:55:04
【问题描述】:

我创建了一个私有 AWS S3 存储桶并将其放入我使用此命令创建的 database.dump 文件中:

pg_dump -Fc --no-acl --no-owner -h localhost -U myuser -d mydatabase > mydatabase.dump

然后,我创建了一个预置的网址:

aws s3 presign s3://fivbackup/strapifivfr.pgsql --expires-in 604800 --region eu-west-3

我可以按照签名的 URL 下载文件。

当我尝试这个命令时,我得到一个错误:

    heroku pg:backups:restore 'RAW_SIGNED_URL' -a fivteam2 DATABASE_URL
    
    //
    Restoring... !
! An error occurred and the backup did not finish.
!
! pg_restore: error: could not read from input file: end of file
! 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

heroku pg:backups:info r013:
=== Backup r013
Database: BACKUP
Started at: 2021-08-27 15:17:09 +0000
Finished at: 2021-08-27 15:17:10 +0000
Status: Failed
Type: Manual
Backup Size: 0.00B (0% compression)

=== Backup Logs
2021-08-27 15:17:10 +0000 2021/08/27 15:17:10 aborting: could not write to output stream: Expected HTTP Status 200, received: "400 Bad Request"
2021-08-27 15:17:10 +0000 waiting for restore to complete
2021-08-27 15:17:10 +0000 pg_restore: error: could not read from input file: end of file
2021-08-27 15:17:10 +0000 pg_restore finished with errors
2021-08-27 15:17:10 +0000 waiting for download to complete
2021-08-27 15:17:10 +0000 download finished with errors
2021-08-27 15:17:10 +0000 please check the source URL and ensure it is publicly accessible

我也尝试了命令heroku pug:push mydatabase DATABASE_URL -a myapp,但无法设置 PGUSER 变量(无法识别术语)。 ps:我在windows上

【问题讨论】:

    标签: postgresql amazon-web-services heroku plpgsql heroku-postgres


    【解决方案1】:

    更新:我以公共模式推送我的数据库,而不是使用预签名 URL(不是最好的选择,但我会继续挖掘),但下面的内容可能会帮助像我这样的一些新手:

    1:我遇到的问题之一是转储文件格式无效。我尝试在 TablePlus 中恢复我的转储文件以测试格式,但没有成功。 因此,我没有使用 CLI 生成转储,而是使用 TablePlus 并选择了自定义格式选项。然后我通过在 TablePlus 中恢复它来测试这次是否可以接受文件格式:它工作!

    2:我想我误解了我在 AWS S3 中的自动化设置,我仍然对 public vs private Bucketspublic vs private 感到很困惑文件

    3:我意识到我的 VSCode 控制台将我粘贴的 url 更改为字符串,所以我改用了桌面 CLI。

    【讨论】:

    • 请在您的回答中提供更多详细信息。正如目前所写的那样,很难理解您的解决方案。
    猜你喜欢
    • 2020-12-30
    • 2013-12-09
    • 2020-11-08
    • 2023-03-15
    • 2015-02-25
    • 1970-01-01
    • 1970-01-01
    • 2017-08-18
    • 2021-09-05
    相关资源
    最近更新 更多