将初始 PostgreSQL 数据库从开发转移到 Heroku 生产
我在开发数据库中本地存储了一组初始生产数据,我希望将其迁移到生产中作为数据的起点。传输这些数据的最佳方式是什么?
是否有办法按照说明使用 pgbackups 似乎并不明显。也许我必须在本地运行某种手动备份,然后使用 pgbackups 将其推送,如果是这种情况,我将不胜感激一些有关完成此操作的具体说明。
I have an initial set of production data stored locally in the development database that I'd like to migrate to production for a starting point for data. What's the best way to transfer this data?
It does not seem evident if there is a way to use pgbackups
as per the instructions. Perhaps I have to run a manual backup of some sort locally and then push it over with pgbackups
and if that is the case, I'd appreciate some specific instructions on accomplishing this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
经过一些额外的挖掘和 Heroku 的回答,导入初始数据的答案是:
1)如果在本地使用 PGSQL,首先转储数据:
pg_dump -U your_username your_database_name -f backup.sql
2 ) 然后按照此处的说明导入 Heroku 的数据库:
http://devcenter.heroku.com/articles/pgbackups#importing_from_a_backup
After some additional digging and an answer from Heroku, the answer for importation of initial data is to:
1) If using PGSQL locally, first dump the data:
pg_dump -U your_username your_database_name -f backup.sql
2) Then follow the instructions found here for importation to Heroku's database:
http://devcenter.heroku.com/articles/pgbackups#importing_from_a_backup
首先使用
pg_dump
:然后使用
heroku pgbackups:restore
:请注意,
mydb.dump
文件需要可由 Heroku 服务器访问。Heroku 开发中心页面有详细说明:
First dump your local database using
pg_dump
:and then use
heroku pgbackups:restore
:Note that the
mydb.dump
file needs to be accessible by the Heroku servers.The Heroku Dev Center page has detailed instructions: