我正在寻找一种获取有关存储在数据湖(azure数据湖gen2 2-adls2)中的所有数据的整体大小的数据的方法。有谁知道如何获取有关数据湖大小的信息(存储了多少数据)? 试图找到合适的API,但到目前为止没有找到任何东西。 感谢您提供的任何提示。
答案 0 :(得分:1)
如果要获取存储在数据湖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"
}