You need to enable JavaScript to run this app.
导航

DescribeTopicPartitions

最近更新时间2022.11.22 16:46:00

首次发布时间2022.04.24 15:56:37

调用 DescribeTopicPartitions 接口获取 Topic 的 Partition 信息。

使用说明

DescribeTopicPartitions 接口提供分页式的查询功能,供您查看指定 Topic 的分区数量、分区 ISR 状态等信息。

  • 此接口的 API Version 为 2018-01-01
  • 此接口的调用频率限制为 100 次/s,超出频率限制会报错 “AccountFlowLimitExceeded”。

请求参数

参数参数类型是否必选示例值说明
PageNumberInteger必选1列表的页码。
PageSizeInteger必选1列表中每一页的条目数量。
InstanceIdString必选kafka-****实例 ID。
TopicNameString必选my_topicTopic 名称。
PartitionNumbersList可选[1,2]分区编号,若不指定,则对所有的分区进行查询。

UnderInsyncOnly

Bool

可选

true

是否只查询存在不同步副本的分区列表,默认值为 false。

  • true:只查询存在不同步副本的分区列表。
  • false:查询全部分区列表。

响应参数

参数参数类型说明
TotalInteger符合查询条件的分区总数。
PartitionsList符合查询条件的分区列表。详细信息请参考【StandardPartitionInfo】。

示例

请求示例

POST https://kafka.volcengineapi.com/?Action=DescribeTopicPartitions&Version=2018-01-01 HTTP/1.1
Accept: application/json
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=********

{
  "PageNumber": 1,
  "PageSize": 1,
  "InstanceId": "kafka-****",
  "TopicName": "my_topic",
  "PartitionNumbers": [
    0
  ],
  "UnderInsyncOnly": true
}

响应示例

{
  "ResponseMetadata": {
    "RequestId": "****************",
    "Action": "DescribeTopicPartitions",
    "Version": "2018-01-01",
    "Service": "kafka",
    "Region": "cn-beijing"
  },
  "Result": {
        "Partitions": [
            {
                "EndOffset": 0,
                "InsyncReplicas": [
                    0,
                    1,
                    2
                ],
                "Leader": 0,
                "MessageCount": 0,
                "PartitionNumber": 0,
                "Replicas": [
                    0,
                    1,
                    2
                ],
                "StartOffset": 0,
                "UnderInsyncReplicas": []
            }
        ],
        "Total": 12
    }
}