Azure-一个“块Blob"被视为一个文件吗? [英] Azure - is one 'block blob' seen as one file?

查看:43
本文介绍了Azure-一个“块Blob"被视为一个文件吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题背景:

这可能是一个简单的问题,但我找不到答案.我刚刚开始使用Azure存储(用于存储图像),想知道一个"blob"是否最多容纳一个文件吗?

这是我的名为 fmfcpics 的容器:

在容器中,我有一个名为 myBlob 的块Blob,其中有一个图像:

通过以下代码,如果我将另一个图像文件上传到 myBlob block blob ,则它将覆盖其中的图像:

  CloudBlockBlob blockBlob = container.GetBlockBlobReference("myblob");使用(var fileStream = System.IO.File.OpenRead(@"C:\ Users \ Me \ Pictures \ Image1.jpg")){blockBlob.UploadFromStream(fileStream);} 

此覆盖是否正确?还是应该能够在 myBlob 上存储多个文件?

解决方案

每个blob是一个完全独立的实体,可以通过uri直接寻址:

http(s)://storageaccountname.blob.core.windows.net/containername/blobname

如果您要管理多个实体(例如您的案例中的image jpg),则可以将每个实体上载到单独的blob名称(您可以在一个容器中自由存储任意数量的内容,然后可能有您想要的多个容器.

注意:这些是 block 斑点.还有 page 个具有随机访问功能的Blob,这是vhd存储的基础(在这种情况下,vhd中将包含一个格式化的文件系统,其中包含多个文件)./p>

Question background:

This may be a simple question but I cant find an answer to it. I've just started using Azure storage (for storing images) and want to know if one 'blob' holds a maximum of one file?

This is my container called fmfcpics:

Within the container I have a block blob named myBlob and within this I have one image:

Through the following code, if I upload another image file to the myBlob block blob then it overwrites the image already in there:

 CloudBlockBlob blockBlob = container.GetBlockBlobReference("myblob");


        using (var fileStream = System.IO.File.OpenRead(@"C:\Users\Me\Pictures\Image1.jpg"))
        {
            blockBlob.UploadFromStream(fileStream);
        }

Is this overwriting correct? Or should I be able to store multiple files at the myBlob?

解决方案

Each blob is a completely separate entity, direct-addressable via uri:

http(s)://storageaccountname.blob.core.windows.net/containername/blobname

If you want to manage multiple entities (such as image jpg's in your case), you would upload each one to a separate blob name (and you're free to store as many as you want within a single container, and you may have as many containers as you want).

Note: These are block blobs. There are also page blobs that have random-access capability, and this is the basis for vhd storage (and in that case, the vhd would have a formatted file system within it, with multiple files).

这篇关于Azure-一个“块Blob"被视为一个文件吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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