You need to enable JavaScript to run this app.
文档中心
消息队列 Kafka版

消息队列 Kafka版

复制全文
下载 pdf
Topic 管理
DescribeTopicPartitions - 查看 Topic 分区
复制全文
下载 pdf
DescribeTopicPartitions - 查看 Topic 分区
调用 DescribeTopicPartitions 接口获取 Topic 的 Partition 信息。​
使用说明​
DescribeTopicPartitions 接口提供分页式的查询功能,供您查看指定 Topic 的分区数量、分区 ISR 状态等信息。​
调试​
API Explorer
您可以通过 API Explorer 在线发起调用,无需关注签名生成过程,快速获取调用结果。
​
请求参数​
下方仅列出该接口特有的请求参数和部分公共参数。更多信息请见公共参数。​
Action string 必选 示例值:DescribeTopicPartitions​
要执行的操作,取值:DescribeTopicPartitions。​
​
Version string 必选 示例值:2022-05-01​
API的版本,取值:2022-05-01。​
​
InstanceId string 必选 示例值:kafka-cnngbnntswg1****x​
实例 ID。​
​
TopicName string 必选 示例值:my_topic​
Topic 名称。​
​
PageNumber integer 必选 示例值:1​
列表的页码,最小值为 1。​
​
PageSize integer 必选 示例值:10​
列表中每一页的条目数量,取值范围为 1~100。​
​
PartitionIds integer[] 可选 示例值:[1,2]​
分区编号。若未指定,则返回所有分区的信息。​
​
UnderInsyncOnly boolean 可选 示例值:true​
是否只查询存在不同步副本的分区列表,默认值为 false。​
  • true:只查询存在不同步副本的分区列表。​
  • false:(默认)查询全部分区列表。​
​
​
​
返回参数​
下方仅列出本接口特有的返回参数。更多信息请参见返回结构。​
Total integer 示例值:2​
符合查询条件的分区总数。​
​
PartitionsInfo object[] 示例值:--​
符合查询条件的分区列表。​
PartitionId integer 示例值:0​
分区编号。​
​
Leader integer 示例值:2​
分区 Leader 编号。​
​
Replicas integer[] 示例值:[2,0,1]​
分区的副本列表。​
​
InsyncReplicas integer[] 示例值:[2,0,1]​
分区的同步副本列表。​
​
UnderInsyncReplicas integer[] 示例值:[]​
不同步的副本列表。​
​
StartOffset long 示例值:7758654122​
分区 Leader 当前最早消息的偏移量。​
​
EndOffset long 示例值:7774940552​
分区 Leader 下一条消息的偏移量,当前最新消息的位置为 EndOffset - 1。​
​
MessageCount long 示例值:16286430​
分区 Leader 内当前的消息个数。其中,MessageCount=EndOffset-StartOffset。​
​
​
​
​
请求示例​
​
POST /?Action=DescribeTopicPartitions&Version=2022-05-01 HTTP/1.1​
Content-Type: application/json​
Host: kafka.volcengineapi.com​
X-Date: 20210328T100802Z​
Authorization: HMAC-SHA256 Credential=AK********/20210328/cn-beijing/Kafka/request, SignedHeaders=x-date, Signature=********​
​
{​
"InstanceId": "kafka-cnngbnntswg1****",​
"TopicName": "my_topic",​
"PageNumber": 1,​
"PageSize": 1​
}​
​
返回示例​
​
{​
"ResponseMetadata": {​
"RequestId": "2023022720063227B3DCC115F59769D448",​
"Action": "DescribeTopicPartitions",​
"Version": "2022-05-01",​
"Service": "Kafka",​
"Region": "cn-beijing"​
},​
"Result": {​
"PartitionsInfo": [​
{​
"EndOffset": 7774940552,​
"InsyncReplicas": [​
2,​
1,​
0​
],​
"Leader": 2,​
"MessageCount": 16286430,​
"PartitionId": 0,​
"Replicas": [​
2,​
1,​
0​
],​
"StartOffset": 7758654122,​
"UnderInsyncReplicas": []​
}​
],​
"Total": 2​
}​
}​
​
错误码​
下表为您列举了该接口与业务逻辑相关的错误码。公共错误码请参见公共错误码文档。​
​
状态码​
错误码​
错误信息​
说明​
400​
InvalidParameter​
The specified parameter is not valid.​
参数值无效。​
403​
OperationDenied.AccountNotAuthorized​
You are not authorized to perform this operation.​
您不具备相关权限 ,请授权或切换账号后重试。​
403​
OperationDenied.InvalidInstanceStatus​
The operation is not valid for the current status of the instance.​
当前实例状态不允许执行该操作。​
403​
OperationDenied.InvalidTopicStatus​
The operation is not valid for the current status of the topic.​
当前Kafka主题状态不允许执行该操作。​
404​
InvalidInstanceId.NotFound​
The specified Instance ID does not exist.​
实例不存在。​
404​
InvalidTopicName.NotFound​
The specified topic does not exist.​
Topic 不存在。​
500​
InternalError​
The request failed due to some unknown error, exception or failure.​
内部错误,请稍后重试。​
​
​
最近更新时间:2025.08.08 17:47:27
这个页面对您有帮助吗?
有用
有用
无用
无用