用于特定文件夹结构中文件的Azure存储 [英] Azure storage for files in specific folder structure

查看:49
本文介绍了用于特定文件夹结构中文件的Azure存储的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当前我有一些ftp,在其中我有一些深入的文件夹和文件结构.甚至可能比根文件夹低10级.由于我已经成功地将本地数据库迁移到了Azure数据库,因此我也想知道是否也可以使用Azure ftp来迁移它.我知道我们有类似Azure存储的东西,我可以为其创建File或Blob类型的Container-其中之一可以像特殊的ftp一样使用-我可以以某种方式在其中使用Container和File或Blob来创建文件夹结构,它在那里如何工作?容器Blob或文件是否用于此类目的?

解决方案

让我添加到NDJ编写的内容中.因此,Azure Blob和文件都可以满足您的目的.

如NDJ所述,Azure Blob存储是2级层次结构系统.在顶部,您有一个Blob容器,每个Blob容器包含0个或更多文件.因此,它本身不支持文件夹结构,但是正如NDJ所提到的,您可以通过使用适当的Blob分隔符(通常为/)来创建子文件夹的错觉.如果要将其与本地文件系统进行比较,则根目录(C :)的目录是blob存储中的容器,然后文件将进入该目录.因此,假设您在计算机的C:\中有一个名为 images 的文件夹,它将是Blob存储中的一个容器.现在,假设您在此文件夹下有2个子文件夹(我们将其称为 hires lores ),并且它们都包含一些文件(例如 image1.png ).将它们移到Azure Blob存储时,容器名称将为 images ,但是blob名称将为 hires/image1.png lores/image1.png .一些存储浏览器会使用此定界符(/)并向您显示您的容器包含2个文件夹,每个文件夹内都有一个名为image1.png的图像,但实际上其中只有2个blobBlob容器.

Azure文件服务与您的本地文件系统非常匹配.在顶层,您有一个 Share ,每个共享都将包含目录和文件.每个目录可以再次包含许多目录和文件.

正如NDJ所述,没有FTP访问Azure存储,但是有许多工具可让您将文件从本地计算机上载到Azure存储,其中许多将保留文件层次结构.您始终可以编写代码自行上传文件.如果您决定使用Azure文件,则可以简单地将文件存储共享作为网络驱动器安装在本地计算机上,然后将文件从本地计算机传输到Azure文件,就像要将文件从一个驱动器传输到另一个驱动器一样./p>

更新

关于Azure Blob存储和文件存储之间的区别,两者都用于存储文件.我可以想到一些差异:

    可以将Azure文件存储中的
  • 共享作为网络驱动器安装在本地计算机/Azure VM上,而Azure Blob存储中的 Blob容器则不能.因此,如果您有一个将文件写入本地文件系统的应用程序,则可以直接使用该应用程序并利用Azure文件存储并将文件写入该网络驱动器,而无需对代码进行很多更改(的典型示例)Lift-And-Shift 这种应用程序.
  • 您可以在 Blob容器上设置 ACL ,而不能在 Share 上进行相同的设置.这使得Azure Blob存储非常适合为您的网站存储静态内容(图像,css,js).要在文件存储中公开文件,您需要使用 Shared Access Signature .
  • 您可以设置 Share 的大小(默认值为5GB),而 Blob容器则不存在这种大小.Blob容器可以达到存储帐户的大小.

要了解Azure文件,我建议阅读以下内容: https://azure.microsoft.com/en-in/documentation/articles/storage-dotnet-how-to-use-files/.

Currently i have some ftp where on it i have some deep structure of folders and files within it. It could be even 10 levels down from root folder. As i migrated already with success my local database to azure database, i wonder also whether is there any azure ftp i could use to migrate this as well. I know we have something like Azure storage and i could create Container for it of type File or Blobs - are one of those could be used like particural ftp - could i create folder structure there somehow using container and either File or Blob for that purpose, how it works there? Does either container blob or file for such purposes?

解决方案

Let me add to what NDJ has written. So both Azure Blobs and Files would serve your purpose.

As mentioned by NDJ, Azure Blob Storage is a 2-level hierarchy system. At the top you have a blob container and the each blob container contains 0 or more files. So it does not support a folder structure per se but as NDJ mentioned, you can create an illusion of a sub folder by using appropriate blob delimiters (usually /). If you were to compare it with local file system, a directory at the root level (C:) is a container in blob storage and then the files would go in there. So imagine you have a folder called images in C:\ of your computer, that would be a container in blob storage. Now imagine that you have 2 sub folders beneath this folder (let's call them hires and lores) and both of them contains some files (say image1.png). When you move them to Azure Blob Storage, the container name would be images but the blob names would be hires/image1.png and lores/image1.png. Some of the storage explorers would take this delimiter (/) and show you that your container contains 2 folders and inside each folder you have an image called image1.png but in reality there are only 2 blobs in that blob container.

Azure File Service is a close match to your local file system. At the top level, you've got a Share and each share will container directories and files. Each directory can again contain many directories and files.

As NDJ mentioned, there's no FTP access to Azure Storage but there are many tools that will allow you to upload files from local computer to Azure Storage and many of them will preserve the file hierarchy. You can always write code to upload the files yourself. If you decide to use Azure Files, you can simply mount a File Storage Share as a network drive on your local computer and then transfer the files from your local computer to Azure Files as if you're transferring files from one drive to another.

UPDATE

Regarding difference between Azure Blob Storage and File Storage, both are used to store files. There are a few differences that I could think of:

  • A Share in Azure File Storage can be mount as a network drive on your local computer/Azure VM whereas a Blob Container in Azure Blob Storage can't. So if you have an application which writes files to local file system, you can take the application as is and make use of Azure File Storage and write the file to that network drive without making many changes to your code (typical example of Lift-And-Shift kind of application.
  • You can set ACL on a Blob Container whereas you can't do the same on a Share. This makes Azure Blob Storage ideal for storing static content (images, css, js) for your websites. For exposing files in File Storage, you would need to resort to Shared Access Signature.
  • You can set the size of a Share (default is 5GB) whereas no such thing exist for a Blob Container. A blob container can go up to the size of a storage account.

To understand Azure Files, I would recommend reading this: https://azure.microsoft.com/en-in/documentation/articles/storage-dotnet-how-to-use-files/.

这篇关于用于特定文件夹结构中文件的Azure存储的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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