繁体   English   中英

如何获取 Azure Cosmos DB 的每个分区的使用量大小?

[英]How to get the usage size for each partition of Azure Cosmos DB?

如何获取 Azure Cosmos DB 的每个分区的使用量大小?

我想获取 Cosmos DB 的每个分区的使用大小。

我根据以下站点运行了 Rest API ,但出现以下错误。

curl -X GET -L -H "Content-Type: application / json" -H "Authorization: Bearer xxxx" https://{account}.documents.azure.com/dbs/{db}/colls/ {collection}

{"code": "BadRequest", "message": "Invalid API version. Ensure a valid x-ms-version header value is passed. Please update to the latest version of Azure Cosmos DB SDK. \ r \ nActivityId: 9993e774- 4b66-4ba0-b71b-2f4ad0edc754,Microsoft.Azure.Documents.Common/2.14.0“}

https://docs.microsoft.com/en-us/azure/cosmos-db/monitor-cosmos-db

I'm trying to get the partition size with Azure Java Cosmos SDK v4, but I don't have the following class that was in SDK v2, so I don't know which class to use in v4.

https://docs.microsoft.com/en-us/java/api/com.microsoft.azure.documentdb.partitionkeystatistics?view=azure-java-stable

谁能给我一些建议?

谢谢安迪 发布您的建议作为帮助其他社区成员的答案。

如果您要发送 GET,则不需要Content-Type header,但您可能需要 Accept header。 所以把它改成-H "Accept: application/json"

{"code": "BadRequest", "message": "Invalid API version. Ensure a valid x-ms-version header value is passed. Please update to the latest version of Azure Cosmos DB SDK.

要修复上述错误,您可以尝试将最新的x-ms-version添加为-H "x-ms-version: 2018-12-31"

您可以参考支持的 REST API 版本

或者,您可以使用 Azure Monitor with Log Analytics 来查询分区的大小,请参阅如何在 Cosmos 容器中查找逻辑分区的大小

如果您仍有疑问,可以在 GitHub 上打开一个问题: azure-sdk-for-java

暂无
暂无

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

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