繁体   English   中英

如何使用nodejs sdk更改azure cosmos db容器的吞吐量?

[英]how to change throughput of azure cosmos db container using nodejs sdk?

如何使用nodejs(javascript SDK)更新现有容器的吞吐量?

参考: https ://docs.microsoft.com/en-us/azure/cosmos-db/set-throughput#update-throughput-on-a-database-or-a-container

https://docs.microsoft.com/en-us/javascript/api/%40azure/cosmos/container?view=azure-node-latest#replace-containerdefinition--requestoptions-

请检查以下REST API请求:

curl -X PUT \
  https://mydbinstance.documents.azure.com/offers/pSMeVMS0g3fc= \
  -H 'Accept: */*' \
  -H 'Cache-Control: no-cache' \
  -H 'Connection: keep-alive' \
  -H 'Content-Type: application/json' \
  -H 'Host: mydbinstance.documents.azure.com' \
  -H 'authorization: type=master&ver=1.0&sig=XE8P49N9Y9yhny09yYJY690N9th9JOIHYnh9N8N89NTHn*TjH=' \
  -H 'content-length: 266' \
  -H 'x-ms-date: Fri, 03 May 2019 10:05:06 GMT' \
  -H 'x-ms-version: 2016-07-11' \
  -d '{  
  "id": "pSMeVMS0g3fc=",  
  "_rid": "pSMeVMS0g3fc=",  
  "_self": "offers/pSMeVMS0g3fc=/",  
  "offerVersion": "V2",  
  "resource": "dbs/pNZpAA==/colls/pSMeVMS0g3fc=/",  
  "content": {  
    "offerThroughput": 4000 
   }, 
  "offerResourceId": "pSMeVMS0g3fc="  
} '

错误响应:输入授权令牌无法为请求提供服务。 请检查是否按照协议构建了预期的有效负载,并检查所使用的密钥。

您可以通过传递选项来修改它,如下所示

/The following code will create a collection in the database. This is where the documents will be stored.
        client.createCollection(databaseUrl, cosmosDb.collection, { offerThroughput: 400 }, (err, created) => {
            if (err) {
                console.log(err);
            }
            else {

            }
        });

暂无
暂无

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

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