跳转到主要内容
在 ClickHouse Cloud 中查询此系统表中的数据分别保存在 ClickHouse Cloud 各节点的本地。因此,如需查看所有数据的完整情况,需要使用 clusterAllReplicas 函数。更多详情请参见此处

描述

包含 Kafka 消费者的相关信息。 适用于 Kafka 表引擎 (ClickHouse 原生集成)

  • database (String) — 带有表引擎的表所在的数据库。
  • table (String) — 带有表引擎的表名称。
  • consumer_id (String) — Kafka 消费者标识符。请注意,一个表可以有多个消费者。由 kafka_num_consumers 参数指定。
  • assignments.topic (Array(String)) — Kafka topic。
  • assignments.partition_id (Array(Int32)) — Kafka 分区 ID。请注意,一个分区只能分配给一个消费者。
  • assignments.current_offset (Array(Int64)) — 当前 offset。
  • assignments.intent_size (Array(Nullable(Int64))) — 在新的 StorageKafka 中,已推送但尚未提交的消息数。
  • exceptions.time (Array(DateTime)) — 最近 10 个异常产生时的时间戳。
  • exceptions.text (Array(String)) — 最近 10 个异常的文本。
  • last_poll_time (DateTime) — 最近一次 poll 的时间戳。
  • num_messages_read (UInt64) — 该消费者读取的消息数。
  • last_commit_time (DateTime) — 最近一次 poll 的时间戳。
  • num_commits (UInt64) — 该消费者的提交总次数。
  • last_rebalance_time (DateTime) — 最近一次 Kafka rebalance 的时间戳。
  • num_rebalance_revocations (UInt64) — 该消费者的分区分配被撤销的次数。
  • num_rebalance_assignments (UInt64) — 该消费者被分配到 Kafka 集群的次数。
  • is_currently_used (UInt8) — 指示该消费者当前是否正在使用的标志。
  • last_used (DateTime64(6)) — 该消费者上次被使用的时间。
  • rdkafka_stat (String) — 库内部统计信息。将 statistics_interval_ms 设为 0 可禁用,默认值为 3000 (每三秒一次) 。
  • dependencies (Array(Array(String))) — 传递性数据库依赖项。
  • missing_dependencies (Array(Array(String))) — 缺失的传递性数据库依赖项。
示例:
SELECT *
FROM system.kafka_consumers
FORMAT Vertical
Row 1:
──────
database:                      test
table:                         kafka
consumer_id:                   ClickHouse-instance-test-kafka-1caddc7f-f917-4bb1-ac55-e28bd103a4a0
assignments.topic:             ['system_kafka_cons']
assignments.partition_id:      [0]
assignments.current_offset:    [18446744073709550615]
exceptions.time:               []
exceptions.text:               []
last_poll_time:                2006-11-09 18:47:47
num_messages_read:             4
last_commit_time:              2006-11-10 04:39:40
num_commits:                   1
last_rebalance_time:           1970-01-01 00:00:00
num_rebalance_revocations:     0
num_rebalance_assignments:     1
is_currently_used:             1
rdkafka_stat:                  {...}
dependencies:                  [['test.mv2','test.target2'],['test.mv1','test.target1']]
missing_dependencies:          []
最后修改于 2026年6月10日