从Heroku迁移到Azure - 正确地进行数据库迁移 [英] Migrating from Heroku to Azure - getting the database migration right

查看:164
本文介绍了从Heroku迁移到Azure - 正确地进行数据库迁移的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Django应用程序在Heroku上生活。我正在将其迁移到Azure,利用他们最近向我提供的120K /年的贷款额度。这是我迄今为止所做的:



i)我用Ubuntu(Standard_D1)创建了一个Azure VM。



< p)ii)我在其上安装了postgresql(我的db选择)



iii)我将我的Heroku应用程序的文件从我的github拉到Azure VM上。

iv)我在Azure VM上创建了一个postgres DB,然后运行 syncdb 来创建所需的表。



v)我调整了 postgresql.conf pg_hba.conf 对某些调优要求等。



vi)我从我的Heroku应用程序的仪表板上备份,并下载。这个备份文件的名称是一个随机的uuid,没有文件格式(例如f0af6457-1a24-47d0-881c-434f9bef7c92)。



vii)我现在正在加紧使用 pg_restore 将备份安装在Azure VM上新创建的+同步应用程序中。



到目前为止,所有这些声音是否正确?我有3个问题:






1) pg_restore 与备份工作我下了Heroku?该备份根本没有文件格式;而我的印象是它必须是一个 .tar 档案与 pg_restore 兼容。



2)我的数据库被称为 mydbname 。数据备份保存在 / datadrive / backup / filename 中。因此,在我的情况下,正确的 pg_restore 命令如下: pg_restore -d mydbname / datadrive / backup / filename



3)在我的Azure应用程序中成功加载正确的数据后,我认为最后一步是将流量Heroku应用程序而不是Azure应用程序。为此,我将调整DNS条目。我觉得在这里你还有什么其他的东西吗?

解决方案

应该工作,但坦率地说,没有测试自己与英雄的备份。
但是我建议的是让它成为一个有效的.dump文件


curl -o latest.dump heroku pg:backups public-url --app< yourappname>


这应该是你的有效的.dump文件,尽管它与您已经拥有的备份没有任何不同。


I have a Django app live on Heroku. I'm migrating it to Azure, taking advantage of the $120K/yr credit they recently offered me. Here's what I've done so far:

i) I created an Azure VM with Ubuntu (Standard_D1).

ii) I installed postgresql on it (my db of choice)

iii) I pulled my Heroku app's files from my github onto the Azure VM.

iv) I created a postgres DB on the Azure VM, and then ran syncdb to create the required tables.

v) I tweaked postgresql.conf and pg_hba.conf to cater to some tuning requirements and such.

vi) I took a backup from my Heroku app's dashboard, and downloaded it. This backup file's name is a random uuid, without a file format (e.g. f0af6457-1a24-47d0-881c-434f9bef7c92).

vii) I'm now gearing up to use pg_restore to fit the backup in the newly created+synced app on Azure VM.

Does all this sound about right so far? I have 3 questions:


1) Will pg_restore work with the backup I got off Heroku? This backup doesn't have a file format at all; whereas I'm under the impression it has to be a .tar archive to be compatible with pg_restore.

2) My database is called mydbname. The data backup is saved at /datadrive/backup/filename. Thus, in my case is the correct pg_restore command something like: pg_restore -d mydbname /datadrive/backup/filename?

3) Once I successfully load the correct data in my Azure app, the final step, in my opinion, is to route traffic going to the Heroku app instead to the Azure app. For that, I'll tweak DNS entries. Am I missing anything else here, in your opinion?

解决方案

Essentially the extension shouldn't matter, your restore should work but frankly haven't tested myself with a heroku backup. However what I would suggest is lets make it a valid .dump file

curl -o latest.dump heroku pg:backups public-url --app <yourappname>

this should be your valid .dump file, though its not any different from the backup you already have..

这篇关于从Heroku迁移到Azure - 正确地进行数据库迁移的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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