【问题标题】:Azure CosmosDB AutoScaling Using Code/AutomationAzure CosmosDB AutoScaling 使用代码/自动化
【发布时间】:2018-06-14 10:15:53
【问题描述】:

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

【问题讨论】:

    标签: c# azure-cosmosdb azure-automation


    【解决方案1】:

    存储会自动扩展。这是自动更改吞吐量的代码

    //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

    【讨论】:

    • 这看起来很棒!我一定错过了它,因为它是 2 天前发布的。谢谢!
    猜你喜欢
    • 2018-11-27
    • 1970-01-01
    • 2014-06-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-02-12
    • 2020-11-24
    • 1970-01-01
    相关资源
    最近更新 更多