Migrating from Heroku to Azure - getting the database migration right

坚强是说给别人听的谎言 提交于 2019-12-12 04:59:23

问题


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?


回答1:


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..



来源:https://stackoverflow.com/questions/33912608/migrating-from-heroku-to-azure-getting-the-database-migration-right

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!