I store data in Azure Storage tables and blob storage. I would like to automatically backup my data to protect against accidental data corruption by users or by a software issue. There isn't a good solution for this from Microsoft and, while there are paid solutions for automatic backups, it seems like there should be a straight-forward way to backup and restore this data.
问题:
回答1:
After doing a lot of research on the best way to automatically backup data, I found that the easiest way to do this is to schedule a job in the Windows Task Scheduler on an Azure virtual machine that uses AZCopy. AZCopy does the work of moving the table data to the VM and then back out to a secondary blob store in Azure to hold the backup. The batch file also causes AZCopy to copy the blobs from the source storage account into the target account directly.
You can see a detailed description of how I made this work complete with links to the batch files that I use to automate the backup at this link: http://www.eastfive.com/2016/03/01/automated-backup-of-azure-storage-tables-and-blobs/
02/08/2018 update on this answer: I raised this question to Azure support on January 18, 2018, assuming that surely they had a way to do this now via a service in Azure. Unfortunately that is not the case and there is (according to Microsoft support) no better way to do table backups than those that existed when this question was first posed. This is the answer from support from 01/24/2018:
"I have reviewed over your case and unfortunately there is not a way to do a snapshot of an entire account or container and so the only way to do snapshots with Azure Storage is through blob iteration and applying snapshots then migrating the snaps over to a secondary account. Or you can simply copy the actual files to another account but this would have higher latency and be more costly on storage capacity, where snapshots would take up less and be quicker to transfer.
The methods we support for transfer are AzCopy and the Data Movement Library which can be used to make custom migration solutions in Java or C#.
If you wanted to automate these processes then you could do this via Powershell and Azure Automation or with Azure Functions but assistance with those solutions would likely need to be raised through another support request as my team purely supports Azure Storage."
So, there still exists no automated way to do these backups. My team is working on a library to do backups. When we have that completed, I will post back here.
05/08/2018 update on this answer: As mentioned, my team has been working on a library to automate backups. You can find the project here: https://github.com/eastfivellc/EastFive.Azure.Storage.Backup. Please feel free to contribute.
10/18/2018 update on this answer: I was able to copy data in Azure using their Azure Data Factory functionality. I used Data Factory to pipe data from my source to target storage for both tables and blobs. However, the data movement costs are exorbitantly high (in the hundreds of dollars per backup). So, this is not a solution for backups. As mentioned in my post from above (and in an answer below), the Azure Data Movement Library is the best solution here.
回答2:
You can also use 3rd party tools like Cerebrata Azure Management Cmdlets or the functionality Asynchronous Copy Blob announced by Microsoft Azure Storage team which will essentially allow you to copy data from one storage account to another storage account without downloading the data locally.
Check the thread for more: What is the best way to backup Azure Blob Storage contents.
Hope this helps.
回答3:
Have a look at the Microsoft Azure Storage Data Movement Library
This seems to offer most of the functionality of AzCopy, but in a nuget package, so you can use it pretty much anywhere you like.
We are running this in a triggered webjob and it seems to be performing really well for both table and blob storage backup.