Web*_*tor 5 heroku heroku-postgres heroku-cli
我正在尝试根据本文将本地 PostgreSQL 数据库复制到 Heroku 。
这是我所做的:
pg_dump -Fc --no-acl --no-owner -h localhost -U postgres mydb > mydb.dump
Run Code Online (Sandbox Code Playgroud)
aws s3 cp mydb.dump s3://my-bucket-name/db-backup/mydb.dump
Run Code Online (Sandbox Code Playgroud)
aws s3 presign s3://my-bucket-name/db-backup/mydb.dump --region us-east-2
Run Code Online (Sandbox Code Playgroud)
在浏览器的隐身选项卡中导航到预先签名的 URL。有用。
我使用双引号是GENERATED_URL因为我在 Windows 上:
heroku pg:backups:restore --app my-app-name --confirm my-app-name "GENERATED_URL"
Run Code Online (Sandbox Code Playgroud)
例如:
heroku pg:backups:restore --app my-app-name --confirm my-app-name "https://s3.us-east-2.amazonaws.com/s3.console.aws.amazon.com/s3/buckets/my-bucket-name/db-backup/mydb.dump?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIABCDVKE2GXCY3YXL7V%2F20200934%2Fus-east-2%2Fs3%2Faws4_request&X-Amz-Date=20200924T164718Z&X-Amz-Expires=3600&X-Amz-SignedHeaders=host&X-Amz-Signature=fb2f51c0d7fbe1234e3740cf23c37f003575d968a1e4961684a47ac627fbae2e"
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
Restoring... !
! An error occurred and the backup did not finish.
!
! Could not initialize transfer
!
! Run heroku pg:backups:info r021 for more details.
'X-Amz-Credential' is not recognized as an internal or external command,
operable program or batch file.
'X-Amz-Date' is not recognized as an internal or external command,
operable program or batch file.
'X-Amz-Expires' is not recognized as an internal or external command,
operable program or batch file.
'X-Amz-SignedHeaders' is not recognized as an internal or external command,
operable program or batch file.
'X-Amz-Signature' is not recognized as an internal or external command,
operable program or batch file.
Run Code Online (Sandbox Code Playgroud)
我发现其他人也有类似的问题,但没有解决方案。预先感谢任何可以提供帮助的人。
这已解决。有两个问题。
这行代码生成了无效的转储文件:
pg_dump -Fc --no-acl --no-owner -h localhost -U postgres mydb > mydb.dump
相反,我需要使用以下语法:
pg_dump -Fc --no-acl --no-owner -h localhost -U postgres -d mydb -f mydb.dump
进行更改后,一切都很顺利。
| 归档时间: |
|
| 查看次数: |
2391 次 |
| 最近记录: |