ruby - 使用 heroku pg :transfer 失败

标签 ruby heroku pg heroku-postgres

我正在尝试使用 heroku pg:transfer 将我的本地数据库传输到 Heroku。

这是我正在运行的命令

heroku pg:transfer -f postgres://<username>:<password>@localhost:5432/<db_name> -t postgres://<app_path>.compute-1.amazonaws.com:5432/<stuff> --app <app_name> --confirm <app_name>

我收到以下错误消息

pg_restore: [archiver] did not find magic string in file header
pg_dump: [custom archiver] could not write to output file: Invalid argument
pg_dump: *** aborted because of error

我在 Windows 上使用 Postgres。有谁知道如何解决这个问题?

最佳答案

导入 PG Backups 可用作将数据库转储从其他来源导入 Heroku Postgres 数据库的便捷工具。

使用开源以压缩格式转储本地数据库 pg_dump工具:

$ PGPASSWORD=mypassword pg_dump -Fc --no-acl --no-owner -h localhost -U myuser mydb > mydb.dump

导入到 Heroku Postgres

为了让 PG Backups 访问和导入您的转储文件,您需要使用 HTTP 可访问的 URL 将其上传到某个地方。我们建议使用 Amazon S3。

pgbackups:restore 命令中使用原始文件 URL:

Be sure to use single quotes around the temporary S3 URL, as it contains ampersands and other characters that will confuse your shell otherwise.

关于ruby - 使用 heroku pg :transfer 失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15672651/

相关文章:

ruby - MongoMapper:如何创建这样的模型

javascript - 添加不需要用户模型的“赞”按钮

ruby-on-rails - 仅使用 ruby​​ 的 Rails authlogic 密码哈希算法

postgresql - gem install pg --with-pg-config 有效, bundle 失败

ruby - 遍历 Ruby 中 pg_conn 查询的所有值

ruby - (Ruby)带有 PG 的 ActiveRecord 尝试将本地用户连接到远程服务器

ruby-on-rails - 将模型传递给组件

java - 在 Heroku 上部署 Spring Boot + React JS 应用程序时出错 - 应用程序崩溃

heroku - 无法使用 RJB gem 将应用程序部署到 Heroku

postgresql - 如何在 Heroku 上为 Postgres 命令启用安静模式