简体   繁体   English

Azure存储帐户Blob容器大小

[英]Azure Storage Account Blobs container size

Is there a way to get the total size of the blobs in a storage account blobs container without iterating over them and summing up the length? 有没有一种方法可以获取存储帐户blob容器中blob的总大小,而无需对其进行遍历和累加长度?

Preferably from the Java API or CLI. 最好来自Java API或CLI。

We are required to get the up to date size on a regular basis and will have a large amount of blobs in the container, and we will have a lot of containers, therefore its not feasible to iterate over the blobs every time to get the sizes. 我们需要定期获取最新的大小,并且容器中将有大量blob,并且我们将有很多容器,因此,每次都遍历这些blob以获取大小是不可行的。

I am afraid it's not possible to bypass blob listing and summing up operation to get the size of container(ie blobs inside it). 恐怕无法绕过blob列表并汇总操作以获取容器的大小(即其中的blob)。 All SDKs are based on REST API , which includes all operation interfaces exposed to us. 所有SDK均基于REST API ,其中包括向我们公开的所有操作接口。 According to those APIs, we can only get the list of blobs and sum up their content length. 根据这些API,我们只能获取blob列表并总结其内容长度。

See an official example. 查看官方示例。 There's a Calculate size on Azure portal, right click on our container and click Container properties , we can see panel as below. 在Azure门户上有一个“ Calculate size ”,右键单击我们的容器,然后单击“ Container properties ,我们可以看到如下面板。 Try to catch the http traffic, we can see it calls list blob operation. 尝试捕获http流量,我们可以看到它调用列表blob的操作。 The Learn more link shows a powershell script to realize the unavoidable process. Learn more链接显示了一个Powershell脚本来实现不可避免的过程。 (Note that once blob count is over 5000, Calculate size displays Blob Count>5000 and Size>XXMiB). (请注意,一旦斑点数超过5000,“ Calculate size显示“斑点数> 5000”和“大小> XXMiB”)。

计算大小

也许您可以使用Azure Monitor API,而该API本身将使用Azure Metrics,因此可以通过REST调用其API,随着时间的推移它会保留统计信息,因此也许您可以通过它来获得所需的信息,否则我看不到任何其他方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM