# 集群 topics 命令

参数 描述
--bootstrap-server <String:server toconnect 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 更新系统默认的配置。

# 查看有多少个集群

集群多个之间用逗号连接

kafka-topics.sh --bootstrap-server localhost:9092,localhost2:9093 --list

# 创建主题

kafka-topics.sh --bootstrap-server localhost:9092 --topic  zhangsanTopic --create --partitions 1 --replication-factor 1 

# 查看描述

kafka-topics.sh --bootstrap-server localhost:9092 --topic first --describe