Working with Azure Regions from China is sometimes a little
bit more complicated. One of the issues that I encountered is the ability to sync content
between different Azure Regions. Inside Azure regions that are in China, things
go very smooth.
The challenge appears in the moment when you need to handle data synchronisation between a region from China and a one from Europe, for
example. I had this case between China East 2 and North Europe. There is no out of the box, the mechanism to do something like that and you need to handle this synchronisation by yourself.
We will take a look at two different scenarios. A simple
one, where is less automation, but the investment is lower, and in 10 minutes
you have the sync mechanism in place. The second one is a little more complex,
but can be used with success for recurrent activities.
Simple Use Case
For simple scenarios, you should not start to write code by yourself.
Take a look at AzCopy that is a command-line tool that enables us to copy
content from local machines to Azure Storage or from one Azure Storage to
another.
Using Azure Copy, we can run a command line that copy content
from one container to another. You can specify what policy you want to use at
the moment when content blobs with the same name already exist.
.\azcopy copy
'https://rvdemo.blob.core.windows.net/demo/all/*?sv=2019-02-02&ss=bfqt&srt=sco&sp=rwdlacup&se=2019-11-09T21:22:50Z&st=2019-10-30T13:22:50Z&spr=https&sig=9IxJn%2BRYgaBu5R%dsds2BG%2Frf4spjNBxYXagNu7BVx1PT1eTk%1D'
'https://rvdemoch.blob.core.chinacloudapi.cn /demo/copy'
--overwrite false
In the above example, we just copied content from one location
from North Europe to a storage account from China. Don’t forget that the blobs
that it is used as a source should be public or you should also include de SAS
key (as I have done in the example). By default the overwrite is set to true,
meaning that if you already the same content in the destination location, the
content is overwritten.
I’ve also done some performance test to see how long it
takes to copy content from one location to another. You can see below the output
of it.
North Europe 10GB send to East China 1h52m 100%
success rate
Japan West 10GB send to East China 1h01m 100%
success rate
East China 1GB send to North Europe 0h21m 100&
success rate
East China 1GB send to Japan West 0h16m 100&
success rate
Automation
For scenarios where you need to be able to repeat the
process over and over again, and you want to have better control, I would use Azure
Data Factory. It is allowing us to define a pipeline where we would have a copy
activity from one Azure Blob to another one. The tricky part here is how to
specify the storage from another subscription. Because in Azure Regions
location in China you will use a different account and a separate
subscription, you are not able to use the Copy Data Tool available inside the
Azure Data Factory.
The good part is that we have a connector inside Data
Factory that can use a SAS for Azure Blob Storage. The approach would be to run
in North Europe the Data Factory Pipeline that would pus the content to the
East China location by using the SAS key for access and authorisation.
{ "name": "AzureBlobStorageLinkedService", "properties": { "type": "AzureBlobStorage", "typeProperties": { "sasUri": { "type": "SecureString", "value": "https://rvdemo.blob.core.windows.net/demo/all/*?sv=2019-02-02&ss=bfqt&srt=sco&sp=rwdlacup&se=2019-11-09T21:22:50Z&st=2019-10-30T13:22:50Z&spr=https&sig=9IxJn%2BRYgaBu5R%dsds2BG%2Frf4spjNBxYXagNu7BVx1PT1eTk%1D'" } }, "connectVia": { "referenceName": "Linked.....", "type": "IntegrationRuntimeReference" } } }
To sum up
We can imagine different solutions, using Azure
Functions, Azure VMs or Azure Batch, but these two solutions are the one
that I used. The first one, based on AzCopy, is simple and can be used with
success for a PoC or for cases you you need to move binary content. The one
based on Azure Data Factory works with success when you need to do heavy data
sync between the two locations.
Comments
Post a Comment