Help Center/ Distributed Message Service for Kafka/ API Reference/ Out-of-Date APIs/ API V2/ Instance Management/ Initiating Partition Reassignment for a Kafka Instance

Initiating Partition Reassignment for a Kafka Instance

Updated on 2025-05-21 GMT+08:00

Function

This API is used to submit a partition reassignment task to a Kafka instance or estimate the partition reassignment duration.

NOTE:

This API is out-of-date and may not be maintained in the future. Please use the API described in Initiating Partition Reassignment for a Kafka Instance.

URI

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

Table 1 URI parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For details, see Obtaining a Project ID.

instance_id

Yes

String

Instance ID.

Request

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

reassignments

Yes

Array of PartitionReassignEntity objects

Partition reassignment plan.

throttle

No

Integer

Partition reassignment threshold.

is_schedule

No

Boolean

Whether the task is scheduled. If no, is_schedule and execute_at can be left blank. If yes, is_schedule is true and execute_at must be specified.

execute_at

No

Long

Schedule time. The value is a UNIX timestamp, in ms.

time_estimate

No

Boolean

Set true to perform time estimation tasks and false to perform reassignment tasks.

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

Status code: 200

Table 5 Response body parameters

Parameter

Type

Description

job_id

String

Task ID. Only job_id is returned for a partition reassignment task.

reassignment_time

Integer

Estimated time, in seconds. Only reassignment_time is returned for a time estimation task.

Example Request

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,
  "time_estimate" : false
}

Example Response

Status code: 200

Reassignment task submitted or the estimated time is returned.

{
  "job_id" : "8a2c259182ab0e9d0182ab1882560009",
  "reassignment_time" : 10
}

Status Code

Status Code

Description

200

Reassignment task submitted or the estimated time is returned.

Error Code

See Error Codes.

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback