Azure CosmosDB AutoScaling使用代码/自动化

问题描述 投票:4回答:1

是否可以使用c#或Azure自动化自动调整CosmosDB吞吐量?请提供示例示例。

c# azure-cosmosdb azure-automation
1个回答
5
投票

存储自动缩放。以下是自动更改吞吐量的代码

//Fetch the resource to be updated
Offer offer = client.CreateOfferQuery()
                  .Where(r => r.ResourceLink == collection.SelfLink)    
                  .AsEnumerable()
                  .SingleOrDefault();

// Set the throughput to 2500 request units per second
offer = new OfferV2(offer, 2500);

//Now persist these changes to the database by replacing the original resource
await client.ReplaceOfferAsync(offer);

在这里查看更多:https://docs.microsoft.com/en-us/azure/cosmos-db/set-throughput

HTH

© www.soinside.com 2019 - 2024. All rights reserved.