【发布时间】:2020-02-10 13:19:04
【问题描述】:
我正在寻找一种方法来获取有关存储在数据湖(azure 数据湖 gen2 2 - adls2)中的所有数据的总体大小的数据。有谁知道如何获取有关数据湖大小(存储多少数据)的此类信息? 试图找到合适的 API,但到目前为止没有找到任何东西。 将感谢任何提示。
【问题讨论】:
标签: azure azure-data-lake
我正在寻找一种方法来获取有关存储在数据湖(azure 数据湖 gen2 2 - adls2)中的所有数据的总体大小的数据。有谁知道如何获取有关数据湖大小(存储多少数据)的此类信息? 试图找到合适的 API,但到目前为止没有找到任何东西。 将感谢任何提示。
【问题讨论】:
标签: azure azure-data-lake
如果您想获取存储在数据湖 gen2 中的所有数据的大小(不包括 File, Table, Queue 存储),您可以使用此 Metrics - List REST API 和 metricnames=BlobCapacity,指定最新的 timespan一小时,例如现在是2019-10-14T05:48:03Z,只需使用timespan=2019-10-14T04:47:03Z/2019-10-14T05:47:03Z,它在我这边工作正常。
示例:
GET https://management.azure.com/subscriptions/<subscription-id>/resourceGroups/<resource-group-name>/providers/Microsoft.Storage/storageAccounts/<storageaccount-name>/blobServices/default/providers/microsoft.insights/metrics?timespan=2019-10-14T04:47:03Z/2019-10-14T05:47:03Z&metricnames=BlobCapacity&api-version=2018-01-01
回应:
{
"cost":0,
"timespan":"2019-10-14T04:47:03Z/2019-10-14T05:47:03Z",
"interval":"PT1H",
"value":[
{
"id":"/subscriptions/xxxxxxx/resourceGroups/xxxxxxx/providers/Microsoft.Storage/storageAccounts/joygen2/blobServices/default/providers/Microsoft.Insights/metrics/BlobCapacity",
"type":"Microsoft.Insights/metrics",
"name":{
"value":"BlobCapacity",
"localizedValue":"Blob Capacity"
},
"displayDescription":"The amount of storage used by the storage account’s Blob service in bytes.",
"unit":"Bytes",
"timeseries":[
{
"metadatavalues":[
],
"data":[
{
"timeStamp":"2019-10-14T04:47:00Z",
"average":44710.0
}
]
}
]
}
],
"namespace":"Microsoft.Storage/storageAccounts/blobServices",
"resourceregion":"eastus"
}
更新:
如果您想获取包括File, Table, Queue 存储在内的所有数据的大小,只需使用UsedCapacity 指标名称即可。
示例:
GET https://management.azure.com/subscriptions/<subscription-id>/resourceGroups/<resource-group-name>/providers/Microsoft.Storage/storageAccounts/<storageaccount-name>/providers/microsoft.insights/metrics?timespan=2019-10-14T04:47:03Z/2019-10-14T05:47:03Z&metricnames=UsedCapacity&api-version=2018-01-01
回应:
{
"cost":0,
"timespan":"2019-10-14T04:47:03Z/2019-10-14T05:47:03Z",
"interval":"PT1H",
"value":[
{
"id":"/subscriptions/xxxxx/resourceGroups/xxxxx/providers/Microsoft.Storage/storageAccounts/xxxxx/providers/Microsoft.Insights/metrics/UsedCapacity",
"type":"Microsoft.Insights/metrics",
"name":{
"value":"UsedCapacity",
"localizedValue":"Used capacity"
},
"displayDescription":"Account used capacity",
"unit":"Bytes",
"timeseries":[
{
"metadatavalues":[
],
"data":[
{
"timeStamp":"2019-10-14T04:47:00Z",
"average":2559131.0
}
]
}
]
}
],
"namespace":"Microsoft.Storage/storageAccounts",
"resourceregion":"eastus"
}
【讨论】:
Aggregation Type 是Average,它以字节为单位,如果你想获得包含其他存储(文件、表、队列)的大小,请查看我的更新。为了帮助理解,您可以在门户中的存储帐户中检查它们 -> Metrics 直接,请参阅i.stack.imgur.com/kqePM.png