如何通过node.js SDK更新集合的吞吐量? [英] How to update the throughput of a collection via node.js SDK?

查看:96
本文介绍了如何通过node.js SDK更新集合的吞吐量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我正在寻找一种使用node.js SDK更新(增加或减少)集合吞吐量的方法.

目前,我正在使用CLI像这样更新它:

 az cosmosdb集合更新\
--collection-name"MyCollection"; \
--name $ accountName \
--db-name"MyDatabase"; \
--resource-group $资源组名称\
--throughput $ newThroughput 

现在,我想使用node.js SDK做同样的事情.看来我可以使用此代码执行某些操作,但仍无法弄清楚:

 const msRestAzure = require('ms-rest-azure');
const CosmosDBManagementClient = require('azure-arm-cosmosdb');

msRestAzure.loginWithServicePrincipalSecret(
    process.env ["APPLICATION_ID"],
    process.env ["APPLICATION_SECRET"],
    process.env ["TENANT_ID"],
    (err,凭证)=> {
        如果(err)抛出err
    
        让客户端=新的CosmosDBManagementClient(凭据,process.env ["SUBSCRIPTION_ID"]);
        //更新集合"MyCollection"的吞吐量;在数据库"MyDatabase"中
    }
); 

谢谢您的帮助.

亲切的问候,
泰迪

解决方案

您可以采用两种不同的粒度来配置吞吐量:

当前,您可以使用Azure门户为容器配置吞吐量, Azure CLI或CosmosDB SDK.

我建议您提供有关以下内容的反馈:

您在这些论坛中分享的所有反馈都将受到监视和审查负责构建Azure的Microsoft工程团队.

希望这会有所帮助.


Hi there,

I'm looking for a way to update (increase or decrease) the throughput of a collection using node.js SDK.

Currently, I'm updating it with CLI like this:

az cosmosdb collection update \
	--collection-name "MyCollection" \
	--name $accountName \
	--db-name "MyDatabase" \
	--resource-group $resourceGroupName \
	--throughput $newThroughput

Now, I want to do the same thing using node.js SDK. It seems that I can do something with this code, but still cannot figure out it:

const msRestAzure = require('ms-rest-azure');
const CosmosDBManagementClient = require('azure-arm-cosmosdb');

msRestAzure.loginWithServicePrincipalSecret(
    process.env["APPLICATION_ID"],
    process.env["APPLICATION_SECRET"],
    process.env["TENANT_ID"],
    (err, credentials) => {
        if (err) throw err
    
        let client = new CosmosDBManagementClient(credentials, process.env["SUBSCRIPTION_ID"]);
        // update the throughput of a collection "MyCollection" in a database "MyDatabase" 
    }
);

Thank you for your help.

Kind regards,
Teddy

解决方案

To scale the provisioned throughput for your application, you can increase or decrease the number of RUs (in the increments or decrements of 100 RUs) at any time, either programmatically or by using the Azure portal.

You can provision throughput at two distinct granularities:

Currently, you can provision throughput for a container by using the Azure portal, Azure CLI, or CosmosDB SDKs.

I would suggest you to provide feedback on the same:

https://feedback.azure.com/forums/263030-azure-cosmos-db

All of the feedback you share in these forums will be monitored and reviewed by the Microsoft engineering teams responsible for building Azure.

Hope this helps.


这篇关于如何通过node.js SDK更新集合的吞吐量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆