Updated on 2023-08-29 GMT+08:00

Initiating Partition Reassigning for a Kafka Instance

Function

This API is used to submit a partition reassigning task for a Kafka instance. If the task is successfully submitted, its job ID is returned.

URI

POST /v2/kafka/{project_id}/instances/{instance_id}/reassign

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For details about how to obtain it, see Obtaining a Project ID.

instance_id

Yes

String

Instance ID.

Request Parameters

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

reassignments

Yes

Array of PartitionReassignEntity objects

Reassignment plan.

throttle

No

Integer

Reassignment threshold.

Table 3 PartitionReassignEntity

Parameter

Mandatory

Type

Description

topic

Yes

String

Topic name.

brokers

No

Array of integers

List of brokers to which partitions are reassigned. This parameter is mandatory in automatic assignment.

replication_factor

No

Integer

Replication factor, which can be specified in automatic assignment.

assignment

No

Array of TopicAssignment objects

Manually specified assignment plan. The brokers parameter and this parameter cannot be empty at the same time.

Table 4 TopicAssignment

Parameter

Mandatory

Type

Description

partition

No

Integer

Partition number in manual assignment.

partition_brokers

No

Array of integers

List of brokers to be assigned to a partition in manual assignment.

Response Parameters

Status code: 200

Table 5 Response body parameters

Parameter

Type

Description

job_id

String

Task ID.

Example Requests

POST https://{endpoint}/v2/kafka/{project_id}/instances/{instance_id}/reassign

{
  "reassignments" : [ {
    "topic" : "topic-1513476102",
    "brokers" : [ 0, 1, 2 ],
    "replication_factor" : 3,
    "assignment" : [ {
      "partition" : 0,
      "partition_brokers" : [ 0, 1, 2 ]
    }, {
      "partition" : 1,
      "partition_brokers" : [ 1, 2, 0 ]
    }, {
      "partition" : 2,
      "partition_brokers" : [ 2, 0, 1 ]
    } ]
  }, {
    "topic" : "topic-1513558717",
    "brokers" : [ 0, 1, 4 ],
    "replication_factor" : 3,
    "assignment" : [ {
      "partition" : 0,
      "partition_brokers" : [ 0, 1, 2 ]
    }, {
      "partition" : 1,
      "partition_brokers" : [ 1, 2, 0 ]
    }, {
      "partition" : 2,
      "partition_brokers" : [ 2, 0, 1 ]
    } ]
  } ],
  "throttle" : 10000000
}

Example Responses

Status code: 200

The partition reassigning task is submitted successfully.

{
  "job_id" : "8a2c259182ab0e9d0182ab1882560009"
}

Status Codes

Status Code

Description

200

The partition reassigning task is submitted successfully.

Error Codes

See Error Codes.