Heroku数据库恢复问题 [英] Heroku database restore issue

查看:144
本文介绍了Heroku数据库恢复问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

经历了> stackoverflow 以及不同论坛上的不同解决方案。但没有一个解决确切的问题。


根据文档:

解决方案

<刚刚找到解决方案,实际上有两件事情在我的情况下是错误的。

上传的 .dump 文件不能被 heroku 。



不需要提供 heroku postgresql DB 完整网址。 b
$ b


所以,对我而言,正确的做法是上传的文件应该可以在没有任何标记的情况下访问,也不需要任何虚拟/间接路径等。文件的URL应该直接指向文件。在我提出的问题中,我使用 firebase 临时托管我的数据库文件以执行 heroku 操作。并且 firebase 没有直接链接到上传的物理文件。



  heroku pg:备份:恢复--app heroku-postgres-f3 ***'https://www.h***.com/dss_iaya_db_dump2.dump'DATABASE_URL 

输入此命令后,我被要求重新输入 heroku 应用程序名称只是为了确认操作。一旦完成,一切都像魅力一样。


Have gone through different solutions available on stackoverflowand also on different forums. But none addresses the precise problem.

As per the documentation: https://devcenter.heroku.com/articles/heroku-postgres-import-export

I have the dump file created from my local database, with this command:

pg_dump -Fc --no-acl --no-owner -h localhost -U postgres dss_iaya>dss_iaya_db_dump1.dump

Then as per documentation, uploaded to a server with public access URL: https://firebasestorage.googleapis.com/v0/b/iaya-664f3.appspot.com/o/dss_iaya_db_dump1.dump?alt=media&token=06167d04-1e98-4e4b-b0e0-9d83a86dd167

Now when I try to restore on Heroku as per its documentation syntax heroku pg:backups:restore [BACKUP] [DATABASE] --app APP using following command, it returns error message when restoring.

heroku pg:backups:restore  --app heroku-postgres-*** 'https://firebasestorage.***/dss_iaya_db_dump1.dump?alt=media&token=***' 'postgres://quesu***:I***@ec2-54-***.eu-west-1.compute.amazonaws.com:5432/d3n***k0' 

I have used *** for security purpose only, as can not mention full credentials. But I believe one can understand the whole syntax.

When I restore same .dump file on a newly created local database it works without any issues and creates/restores the whole database with tables and data.

解决方案

Just found the solution, actually two things were wrong in my case.

One, the uploaded .dump file was not well readable/usable by the heroku.

Two, the heroku postgresql DB complete URL was not required to be provided.

So, the right way that worked for me was that the uploaded file should be accessible without any token and also without any virtual/indirect path, etc. The URL to the file should point to the file directly. In my questioned problem, I was using firebase to host my DB file temporarily to do the heroku operation. And firebase was not giving direct URL to the uploaded physical file.

heroku pg:backups:restore  --app heroku-postgres-f3*** 'https://www.h***.com/dss_iaya_db_dump2.dump' DATABASE_URL

After typing this command, I was asked to retype the heroku app name just to confirm the operation. Once done, everything worked like a charm.

这篇关于Heroku数据库恢复问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆