Azure Cosmos DB - API for NoSQL의 데이터베이스 또는 컨테이너에 대한 자동 크기 조정 처리량 프로비전

적용 대상: NoSQL

이 문서에서는 Azure Cosmos DB for NoSQL에서 데이터베이스 또는 컨테이너(컬렉션, 그래프 또는 테이블)에 자동 크기 조정 처리량을 프로비전하는 방법을 설명합니다. 단일 컨테이너에서 자동 크기 조정을 사용하도록 설정하거나 데이터베이스에서 자동 크기 조정 처리량을 프로비전하고 데이터베이스의 모든 컨테이너 간에 공유할 수 있습니다.

다른 API를 사용하는 경우 API for MongoDB, API for Cassandra, API for Gremlin 문서를 참조하여 처리량을 프로비전합니다.

Azure Portal

자동 크기 조정을 사용하여 새 데이터베이스 또는 컨테이너 만들기

  1. Azure Portal 또는 Azure Cosmos DB 탐색기에 로그인합니다.

  2. Azure Cosmos DB 계정으로 이동하여 데이터 탐색기 탭을 엽니다.

  3. 새 컨테이너를 선택합니다. 데이터베이스, 컨테이너 및 파티션 키의 이름을 입력합니다. 데이터베이스 또는 컨테이너 처리량을 고려하여 자동 크기 조정 옵션을 선택하고 데이터베이스나 컨테이너를 확장하고 싶은 만큼 최대 처리량(RU/s)을 설정합니다.

    Creating a container and configuring autoscale provisioned throughput

  4. 확인을 선택합니다.

공유 처리량 데이터베이스에 자동 크기 조정을 프로비전하려면 새 데이터베이스를 만들 때 데이터베이스 처리량 프로비전 옵션을 선택합니다.

기존 데이터베이스 또는 컨테이너에서 자동 크기 조정 사용

  1. Azure Portal 또는 Azure Cosmos DB 탐색기에 로그인합니다.

  2. Azure Cosmos DB 계정으로 이동하여 데이터 탐색기 탭을 엽니다.

  3. 컨테이너에 대한 크기 조정 및 설정 또는 데이터베이스에 대한 크기 조정을 선택합니다.

  4. 크기 조정에서 자동 크기 조정 옵션, 저장을 선택합니다.

    Enabling autoscale on an existing container

참고 항목

기존 데이터베이스 또는 컨테이너에서 자동 크기 조정을 사용하도록 설정하면 현재의 수동 프로비전된 처리량 설정 및 스토리지에 따라 최대 RU/s의 시작 값이 시스템에 의해 결정됩니다. 작업이 완료된 후 필요하면 최대 RU/s를 변경할 수 있습니다. 자세히 알아보기.

Azure Cosmos DB .NET V3 SDK

Azure Cosmos DB .NET SDK for API for NoSQL의 버전 3.9 이상을 사용하여 자동 크기 조정 리소스를 관리합니다.

Important

.NET SDK를 사용하여 새 자동 크기 조정 리소스를 만들 수 있습니다. 이 SDK는 자동 크기 조정 처리량과 표준(수동) 처리량 간의 마이그레이션을 지원하지 않습니다. 마이그레이션 시나리오는 현재 Azure Portal, CLI, PowerShell에서만 지원됩니다.

공유 처리량을 사용하여 데이터베이스 만들기

// Create instance of CosmosClient
CosmosClient cosmosClient = new CosmosClient(Endpoint, PrimaryKey);
 
// Autoscale throughput settings
ThroughputProperties autoscaleThroughputProperties = ThroughputProperties.CreateAutoscaleThroughput(1000); //Set autoscale max RU/s

//Create the database with autoscale enabled
database = await cosmosClient.CreateDatabaseAsync(DatabaseName, throughputProperties: autoscaleThroughputProperties);

전용 처리량을 사용하여 컨테이너 만들기

// Get reference to database that container will be created in
Database database = await cosmosClient.GetDatabase("DatabaseName");

// Container and autoscale throughput settings
ContainerProperties autoscaleContainerProperties = new ContainerProperties("ContainerName", "/partitionKey");
ThroughputProperties autoscaleThroughputProperties = ThroughputProperties.CreateAutoscaleThroughput(1000); //Set autoscale max RU/s

// Create the container with autoscale enabled
container = await database.CreateContainerAsync(autoscaleContainerProperties, autoscaleThroughputProperties);

현재 처리량(RU/s) 읽기

// Get a reference to the resource
Container container = cosmosClient.GetDatabase("DatabaseName").GetContainer("ContainerName");

// Read the throughput on a resource
ThroughputProperties autoscaleContainerThroughput = await container.ReadThroughputAsync(requestOptions: null); 

// The autoscale max throughput (RU/s) of the resource
int? autoscaleMaxThroughput = autoscaleContainerThroughput.AutoscaleMaxThroughput;

// The throughput (RU/s) the resource is currently scaled to
int? currentThroughput = autoscaleContainerThroughput.Throughput;

자동 크기 조정 최대 처리량(RU/s) 변경

// Change the autoscale max throughput (RU/s)
await container.ReplaceThroughputAsync(ThroughputProperties.CreateAutoscaleThroughput(newAutoscaleMaxThroughput));

Azure Cosmos DB Java V4 SDK

Azure Cosmos DB Java SDK for API for NoSQL의 버전 4.0 이상을 사용하여 자동 크기 조정 리소스를 관리할 수 있습니다.

Important

Java SDK를 사용하여 새 자동 크기 조정 리소스를 만들 수 있습니다. 이 SDK는 자동 크기 조정 처리량과 표준(수동) 처리량 간의 마이그레이션을 지원하지 않습니다. 마이그레이션 시나리오는 현재 Azure Portal, CLI, PowerShell에서만 지원됩니다.

공유 처리량을 사용하여 데이터베이스 만들기

// Create instance of CosmosClient
CosmosAsyncClient client = new CosmosClientBuilder()
    .setEndpoint(HOST)
    .setKey(PRIMARYKEY)
    .setConnectionPolicy(CONNECTIONPOLICY)
    .buildAsyncClient();

// Autoscale throughput settings
ThroughputProperties autoscaleThroughputProperties = ThroughputProperties.createAutoscaledThroughput(1000); //Set autoscale max RU/s

//Create the database with autoscale enabled
CosmosAsyncDatabase database = client.createDatabase(databaseName, autoscaleThroughputProperties).block().getDatabase();

전용 처리량을 사용하여 컨테이너 만들기

// Get reference to database that container will be created in
CosmosAsyncDatabase database = client.createDatabase("DatabaseName").block().getDatabase();

// Container and autoscale throughput settings
CosmosContainerProperties autoscaleContainerProperties = new CosmosContainerProperties("ContainerName", "/partitionKey");
ThroughputProperties autoscaleThroughputProperties = ThroughputProperties.createAutoscaledThroughput(1000); //Set autoscale max RU/s

// Create the container with autoscale enabled
CosmosAsyncContainer container = database.createContainer(autoscaleContainerProperties, autoscaleThroughputProperties, new CosmosContainerRequestOptions())
                                .block()
                                .getContainer();

현재 처리량(RU/s) 읽기

// Get a reference to the resource
CosmosAsyncContainer container = client.getDatabase("DatabaseName").getContainer("ContainerName");

// Read the throughput on a resource
ThroughputProperties autoscaleContainerThroughput = container.readThroughput().block().getProperties();

// The autoscale max throughput (RU/s) of the resource
int autoscaleMaxThroughput = autoscaleContainerThroughput.getAutoscaleMaxThroughput();

// The throughput (RU/s) the resource is currently scaled to
int currentThroughput = autoscaleContainerThroughput.Throughput;

자동 크기 조정 최대 처리량(RU/s) 변경

// Change the autoscale max throughput (RU/s)
container.replaceThroughput(ThroughputProperties.createAutoscaledThroughput(newAutoscaleMaxThroughput)).block();

Azure Resource Manager

Azure Resource Manager 템플릿은 모든 Azure Cosmos DB API의 새로운 데이터베이스 또는 컨테이너 수준 리소스에서 자동 크기 조정 처리량을 프로비저닝하는 데 사용될 수 있습니다. 샘플은 Azure Cosmos DB의 Azure Resource Manager 템플릿을 참조하세요. 디자인적으로, Azure Resource Manager 템플릿은 기존 리소스에서 프로비저닝된 처리량과 자동 크기 조정 처리량 사이에서 마이그레이션하는 데 사용할 수 없습니다.

Azure CLI

Azure CLI는 새로운 데이터베이스 또는 모든 Azure Cosmos DB API용 컨테이너 수준 리소스에서 자동 크기 조정 처리량을 프로비전하거나 기존 리소스에서 자동 크기 조정 하기 위해 사용할 수 있습니다. 샘플은 Azure Cosmos DB의 Azure CLI 샘플을 참조하세요.

Azure PowerShell

Azure PowerShell은 새로운 데이터베이스 또는 모든 Azure Cosmos DB API용 컨테이너 수준 리소스에서 자동 크기 조정 처리량을 프로비전하거나 기존 리소스에서 자동 크기 조정 하기 위해 사용할 수 있습니다. 샘플은 Azure Cosmos DB의 Azure PowerShell 샘플을 참조하세요.

다음 단계