简体   繁体   English

Heroku with Rails 5.2 尝试将数据库从 Heroku 拉到本地时出错 (pg:pull)

[英]Heroku with Rails 5.2 Error When trying to Pull the Database from Heroku to local (pg:pull)

I'm trying to replace my local DB with that from my live Heroku app.我正在尝试用我的实时 Heroku 应用程序中的数据库替换我的本地数据库。

My sausage fingers almost dropped my Heroku database instead of the local one, but I aborted almost immediately.我的香肠手指几乎掉了我的 Heroku 数据库而不是本地数据库,但我几乎立即中止了。 My live site is unaffected, but when I try to run this:我的实时站点不受影响,但是当我尝试运行它时:

heroku pg:pull DATABASE MABsecret_development

I get this error:我收到此错误:

pg_dump: server version: 12.2 (Ubuntu 12.2-2.pgdg16.04+1); pg_dump version: 11.5
pg_dump: aborting because of server version mismatch
pg_restore: [custom archiver] could not read from input file: end of file
 ▸    pg_dump errored with 1

I've looked all over SO, but can't find a situation that parallels mine.我已经查看了所有内容,但找不到与我相似的情况。 Can anyone help me get my Heroku to be "pullable"?谁能帮我让我的 Heroku 变得“可拉”? My local db is currently dropped and waiting!我的本地数据库目前正在等待中!

I faced the same issue once, and I noticed that I didn't have the same version of PG installed on my local, so I uninstalled it and then installed the same version that was on the heroku.我曾经遇到过同样的问题,我注意到我本地没有安装相同版本的 PG,所以我卸载了它,然后安装了与 heroku 上相同的版本。

You can check the postgresql version on heroku by opening the Heroku Postgres from add-ons list.您可以通过从附加组件列表中打开Heroku Postgres来检查 heroku 上的 postgresql 版本。

Try pulling the database again, after re-installing the similar version.重新安装类似版本后,再次尝试拉取数据库。 It worked for me!它对我有用!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM