在 Azure Cosmos DB 的数据库中预配标准(手动)吞吐量 - SQL APIProvision standard (manual) throughput on a database in Azure Cosmos DB - SQL API
适用于:
SQL API
本文说明了如何在 Azure Cosmos DB SQL API 的数据库中预配标准(手动)吞吐量。This article explains how to provision standard (manual) throughput on a database in Azure Cosmos DB SQL API. 可以为单个容器预配吞吐量,也可以为数据库预配吞吐量,并在数据库中的容器之间共享吞吐量。You can provision throughput for a single container, or for a database and share the throughput among the containers within it. 若要了解何时使用容器级别和数据库级别吞吐量,请参阅容器和数据库预配吞吐量的用例一文。To learn when to use container level and database level throughput, see the Use cases for provisioning throughput on containers and databases article. 可以使用 Azure 门户或 Azure Cosmos DB SDK 来预配数据库级别吞吐量。You can provision database level throughput by using the Azure portal or Azure Cosmos DB SDKs.
如果使用的是其他 API,请参阅 API for MongoDB、Cassandra API、Gremlin API 这几篇文章来预配吞吐量。If you are using a different API, see API for MongoDB, Cassandra API, Gremlin API articles to provision the throughput.
使用 Azure 门户预配吞吐量Provision throughput using Azure portal
登录 Azure 门户。Sign in to the Azure portal.
创建新的 Azure Cosmos 帐户,或选择现有的 Azure Cosmos 帐户。Create a new Azure Cosmos account, or select an existing Azure Cosmos account.
打开“数据资源管理器”窗格,然后选择“新建数据库” 。Open the Data Explorer pane, and select New Database. 提供以下详细信息:Provide the following details:
- 输入数据库 ID。Enter a database ID.
- 选择“预配数据库吞吐量”选项。Select the Provision database throughput option.
- 输入吞吐量(例如 1000 RU)。Enter a throughput (for example, 1000 RUs).
- 选择“确定”。Select OK.
使用 Azure CLI 或 PowerShell 预配吞吐量Provision throughput using Azure CLI or PowerShell
若要创建具有共享吞吐量的数据库,请参阅To create a database with shared throughput see,
- 使用 Azure CLI 创建数据库Create a database using Azure CLI
- 使用 PowerShell 创建数据库Create a database using PowerShell
使用 .NET SDK 预配吞吐量Provision throughput using .NET SDK
备注
可以使用适用于 SQL API 的 Azure Cosmos SDK 为所有 API 预配吞吐量。You can use Azure Cosmos SDKs for SQL API to provision throughput for all APIs. 也可以选择将以下示例用于 Cassandra API。You can optionally use the following example for Cassandra API as well.
//set the throughput for the database
RequestOptions options = new RequestOptions
{
OfferThroughput = 500
};
//create the database
await client.CreateDatabaseIfNotExistsAsync(
new Database {Id = databaseName},
options);
后续步骤Next steps
请参阅以下文章,了解在 Azure Cosmos DB 中预配的吞吐量:See the following articles to learn about provisioned throughput in Azure Cosmos DB:
- 全局缩放预配的吞吐量Globally scale provisioned throughput
- 在容器和数据库上预配吞吐量Provision throughput on containers and databases
- 如何在容器上预配标准(手动)吞吐量How to provision standard (manual) throughput for a container
- 如何为容器预配自动缩放吞吐量How to provision autoscale throughput for a container
- Azure Cosmos DB 中的请求单位和吞吐量Request units and throughput in Azure Cosmos DB