Changing Partition Quantity

Function

This API is used to change the number of partitions in a specific stream.

When changing the number of partitions, you need to specify the stream name and the number of target partitions.

URI

  • URI format

    PUT /v2/{project_id}/streams/{stream_name}

  • Parameter description

    None

Request

  • Example request
    PUT https://{endpoint}/v2/{project_id}/streams/stream_name_test
     
    {
    "stream_name":"stream_name_test",
    "target_partition_count":5
    }
  • Parameter description
    Table 1 Parameter description

    Parameter

    Mandatory

    Type

    Description

    stream_name

    Yes

    String

    Name of the stream created on the management console.

    A stream name is 1 to 64 characters long. Only letters, digits, hyphens (-), and underscores (_) are allowed.

    target_partition_count

    Yes

    int

    Number of the target partitions.

    The value is an integer larger than 0.

    If the value is greater than the number of the current partitions, scale-up will be performed. If the value is smaller than the number of the current partitions, scale-down will be performed.

    NOTE:

    Each stream can be scaled up and down a total of five times within one hour. After the stream is successfully scaled up or down, it cannot be scaled up or down again within the next one hour.

Response

  • Example response
    {
    "stream_name":"stream_name_test",
    "current_partition_count":2
    "target_partition_count":5
    }
  • Parameter description
    Table 2 Response parameter description

    Parameter

    Type

    Description

    stream_name

    String

    Name of the stream whose partition quantity needs to be changed.

    current_partition_count

    int

    Number of the current partitions

    target_partition_count

    int

    Number of the target partitions.

Status Code

  • Normal

    200 OK

  • Failed

    For more information, see Error Codes.