标签搜索

kafka常用命令

mrui
2025-12-02 / 0 评论 / 2 阅读 / 正在检测是否收录...

topic 相关

说明:

  • 红色的是必需要指定的参数
  • 使用bin/kafka-topics.sh 可查看所有的参数信息
参数描述
--bootstrap-server <String: server connect to> 连接kafka broker主机名称和端口号
--topic <String: topic> 操作的topic名称
--create创建主题
--delete删除主题
--alter修改主题
--list查看所有主题
--describe查看主题详细描述
--partitions <Integer: # of partitions>设置分区数
--replication-factor <Integer: replication factor>设置分区副本
--config <String: name=value>更新系统默认的配置
root@kf1:/opt/kafka# bin/kafka-topics.sh --bootstrap-server kf1:9092 --describe --topic first
Topic: first    TopicId: o4AxZZfwQhG-QR38nHUGxQ    PartitionCount: 3    ReplicationFactor: 3    Configs: min.insync.replicas=1,segment.bytes=1073741824
    Topic: first    Partition: 0    Leader: 1    Replicas: 1,2,3    Isr: 1,2,3    Elr:     LastKnownElr: 
    Topic: first    Partition: 1    Leader: 2    Replicas: 2,3,1    Isr: 2,3,1    Elr:     LastKnownElr: 
    Topic: first    Partition: 2    Leader: 3    Replicas: 3,1,2    Isr: 3,1,2    Elr:     LastKnownElr: 
  • Topic: 主题名称
  • TopicId: 主题ID
  • PartitionCount: 分区数量
  • ReplicationFactor: 副本数量
  • Configs: min.insync.replicas=1,segment.bytes=1073741824
  • Topic:
  • Partition: 分区ID
  • Leader: 副本的leader
  • Replicas: 副本存储位置
  • Isr: 连接的副本
  • LastKnownElr
0

评论 (0)

取消