目前我正在做一个 heroku db:pull 到我的本地机器,然后 heroku db:push --app testapp 但这会变得非常耗时。我有一些种子数据,但它不像使用我的真实世界数据测试那么准确。由于它们都存储在相邻的AWS云上,所以必须有更快的方式来移动数据?
我想过使用一个heroku包,但我注意到了animate命令不见了?
捆绑:animate< bundle> #将一个包动画成一个新的应用程序解决方案
在Rails应用程序的暂存,测试和生产环境之间迁移数据库。而 heroku db:pull / push 非常缓慢。到目前为止,我发现的最好方法是使用 Heroku PG备份加载项和它是免费的。我遵循以下步骤将生产数据库迁移到登台服务器:
$ b1)为生产应用程序db创建备份
heroku pg:备份捕获--app production-app这将从主数据库(通常是database.yml中的生产数据库)生成b001备份文件。b)查看所有备份(可选)
heroku pg:备份--app production-app3)现在使用pg:backups restore命令从生产服务器上的最后一个备份文件填充登台服务器数据库
heroku pg:备份恢复$(备份恢复公共网址--app生产应用程序)DATABASE_URL --app staging-app请记住,还原是一种破坏性操作,它会在将其替换为备份文件的内容之前删除现有数据。
Is there a faster way to transfer my production database to a test app?
Currently I'm doing a heroku db:pull to my local machine then heroku db:push --app testapp but this is becoming time consuming. I have some seed data but it is not nearly as accurate as simply testing with my real-world data. And since they're both stored on a neighboring AWS cloud, there must be a faster way to move the data?
I thought about using a heroku bundle, but I noticed the animate command is gone?
bundles:animate <bundle> # animate a bundle into a new app解决方案
It's quite common to migrate databases between staging, testing and production environments for Rails Apps. And heroku db:pull/push is painfully slow. The best way I have found so far is using Heroku PG Backups add-on and it's free. I followed following steps to migrate production database to staging server:
1) Create the backup for the production-app db
heroku pg:backups capture --app production-appThis will generate b001 backup file from the main database (usually production db in database.yml)
2) To view all the backups (OPTIONAL)
heroku pg:backups --app production-app3) Now use the pg:backups restore command to populate staging server database from the last backup file on production server
heroku pg:backups restore $(heroku pg:backups public-url --app production-app) DATABASE_URL --app staging-appRemember that restore is a destructive operation, it will delete existing data before replacing it with the contents of the backup file.
更多推荐
将数据库从一个heroku应用更快地转移到另一个应用
发布评论