从Heroku提取生产数据的方法有哪些? [英] Is There A Faster Way To Pull Production Data From Heroku Than Taps?

查看:84
本文介绍了从Heroku提取生产数据的方法有哪些?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我经常需要克隆生产数据来调查错误。即使数据库数据量较小,heroku db:pull(tap)需要5分钟以上,并且似乎很有可能失败。 是否有另一种方法来提取数据库?



可选流程/文章的库也将不胜感激。


'的div类= h2_lin>解决方案

查核 pgbackups 。它取代了Heroku包的命令,并会给你一个相当于mysqldump的postgres。这比大型数据集的Taps文明得多。

  heroku pgbackups:capture 

将创建一个转储文件并存储它。要下载转储文件,您需要获得的url

  heroku pgbackups:url b001(或任何备份的ID号是)

这将返回一个url,您可以从中下载您的转储。如果你想要的话,你可以将它粘贴到Firefox中,或者像他们所建议的那样使用curl / wget。使用pg_restore的转储文件,因为它们在文档说加载到数据库:

  pg_restore的--verbose --clean  - -no-ACL --no所有者-h本地主机-U test_user -d myapp_development /home/mike/Downloads/b001.dump 

pg_restore:连接到数据库进行恢复


I often need to clone production data to investigate bugs. Even with a trivial database size heroku db:pull (taps) takes 5+ minutes and seems to have a high chance of failing. Is there an alternative method to pull the database?

Libraries for alternative processes / articles would also be appreciated.

解决方案

Check out pgbackups. It has replaced the Heroku bundle command and will give you a the postgres equivalent of mysqldump. This is far more civilized than Taps for large datasets.

heroku pgbackups:capture

Will create a dumpfile and store it. To download the dumpfile you need the url which you get with

heroku pgbackups:url b001 (or whatever the id number of the backup is)

That will return an url from which you can download your dump. You can paste it into Firefox if you want or use curl/wget like they suggest. The use pg_restore to load the dump file into your database as they say in the docs:

pg_restore --verbose --clean --no-acl --no-owner -h localhost -U test_user -d myapp_development /home/mike/Downloads/b001.dump

pg_restore: connecting to database for restore

这篇关于从Heroku提取生产数据的方法有哪些?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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