更新时间:2023-08-16 GMT+08:00
Kafka实例开始分区重平衡任务
功能介绍
该接口用于向Kafka实例提交分区重平衡任务,若成功则返回重平衡任务的job id。
URI
POST /v2/kafka/{project_id}/instances/{instance_id}/reassign
|
参数 |
是否必选 |
参数类型 |
描述 |
|---|---|---|---|
|
project_id |
是 |
String |
项目ID,获取方式请参见获取项目ID。 |
|
instance_id |
是 |
String |
实例ID。 |
请求参数
|
参数 |
是否必选 |
参数类型 |
描述 |
|---|---|---|---|
|
reassignments |
是 |
Array of PartitionReassignEntity objects |
重平衡分配方案。 |
|
throttle |
否 |
Integer |
重平衡门限值。 |
|
参数 |
是否必选 |
参数类型 |
描述 |
|---|---|---|---|
|
topic |
是 |
String |
topic名称 |
|
brokers |
否 |
Array of integers |
分区重平衡到的broker列表,自动生成分配方案时需指定该参数。 |
|
replication_factor |
否 |
Integer |
副本因子,自动生成分配方案时可指定。 |
|
assignment |
否 |
Array of TopicAssignment objects |
手动指定的分配方案。brokers参数与该参数不能同时为空。 |
响应参数
状态码: 200
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
job_id |
String |
任务ID。 |
请求示例
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
}
响应示例
状态码: 200
提交重平衡任务成功。
{
"job_id" : "8a2c259182ab0e9d0182ab1882560009"
}
状态码
|
状态码 |
描述 |
|---|---|
|
200 |
提交重平衡任务成功。 |
错误码
请参见错误码。
父主题: 实例管理