Windows Azure Platform Family of articles Catalog
Readers familiar with the Azure platform know that azure blobs have a three-tier architecture. such as: (note blob.core.chinacloudapi.net is the service Endpoint for Azure China)
1.Blob Name: Store account names
2.Container name, container name. Conceptually similar to a folder
3.Blob Name: filename
The azure Storage block blob concept is similar to a network disk, where users can save files, pictures, and photos directly into an azure Block blob.
Azure Block blobs have only one layer of structure, or container/blobname, compared to traditional file system catalogs. Azure Block blobs do not support multi-level catalogs.
If the customer's software architecture requires support for multiple levels of catalogs, migrating to an azure Block blob will encounter some files. Such as:
Qq.png the system-wide directory for this file is: D:\1\2\3\qq.png
And we have an identical filename, qq.png, whose directory is as follows:
The file name is the same as the qq.png above, but the directory is different.
In this case, we have two solutions:
I. Using a relational database, creating a database table, implementing a multi-level directory with Azure storage correspondence
Two. Rename the azure Blob name
Here are 2 solutions for each of these
I. using a relational database, creating a database table, implementing a multi-level directory with Azure storage correspondence
In this case, we need to prepare the following actions
1. Rename the file system file to a GUID. such as 111-222-333.jpg
2. Create the following table in the Relational database field:
Index |
Source Data Name |
Azureblob Data Name |
Azureblobaccount |
Azureblobcontainername |
Azurebloburl |
1 |
Myphoto.png |
111-222-333.jpg |
Contoso |
Photos |
Https://contoso.blob.core.chinacloudapi.cn/photos/111-222-333.jpg |
2 |
Myword.docx |
Aaa-bbb-ccc.docx |
Contoso |
Words |
Https://contoso.blob.core.chinacloudapi.cn/words/AAA-BBB-CCC.docx |
By renaming the file name from the source data in the filesystem, and saving the renamed file to Azure storage, there is only one level of directory for the Azure blob to improve.
Two. Modify the azure Blob name directly, with the file name set to include \
This allows us to modify the Blob name to: 1/2/3/qq.png and A/b/c/qq.png. Modify the full path to the file system:
such as the following connection:
Https://leizhangstorage.blob.core.chinacloudapi.cn/share/1/2/3/qq.png
Https://leizhangstorage.blob.core.chinacloudapi.cn/share/A/B/C/qq.png
The results appear as follows:
This allows you to implement a multilevel catalog of azure blobs.
In addition, how can you easily save files of local folders to Azure storage? 2 methods are recommended here:
1. Using Azcopy
Refer to my previous blog post:Windows Azure Storage (21) uses the Azcopy tool to speed up Azure Storage transfer
Recursively replicate all files and subdirectories in a directory on the local computer to azure storage
The command is as follows:
azcopy/source:c:\myfolder/dest:https://leizhangstorage.blob.core.windows.net/files/destkey:[Storage Account Key]/S
Note that the last parameter in the above command line is/S
Suppose C:\myfolder has the following directories:
C:\myfolder\abc.txt
C:\myfolder\abc1.txt
C:\myfolder\abc2.txt
C:\myfolder\subfolder\a.txt
C:\myfolder\subfolder\abcd.txt
After executing the azcopy command above, all 5 files above will be copied to azure storage.
2. Using BLOB Browser
The azcopy described above is, after all, a command-line tool, and you can use BlobbrowserIf you are unfamiliar with command-line tools.
Blobbrowser is a GUI graphical interface tool, behind the fact is the use of azcopy command line tools.
After we install Blobbrowser, we can configure it on the interface. Such as:
, we click Add to add new storage account information:
In the pop-up window, enter the following information:
In
-Name Input display names
-Storage account name, enter the storage username
-Storage Account Key, enter the key for storage
Note that if you use the home by century connected Ops Azure, you need to tick the using China Endpoint.
This allows you to manage and upload your azure Storage account using the Blob browser graphical interface.
How Windows Azure Storage Azure Storage supports multi-level catalogs