记录常用的kafka常用的topic相关命令
查看topic列表
[root@shtest01 ~]# /usr/lib/kafka/bin/./kafka-topics.sh --list --zookeeper localhost:2181/kafka
创建topic
[root@shtest01 ~]# /usr/lib/kafka/bin/./kafka-topics.sh --create --topic topictest03 --replication-factor 1 --partitions 1 --zookeeper host01:2181,host02:2181,host03:2181/kafka
Created topic "topictest03".
--create
:创建命令;
--topic
:后面指定topic名称;
--replication-factor
:后面指定副本数;
--partitions
:指定分区数,根据broker的数量决定;
--zookeeper
:后面指定zookeeper.connect
的zk链接;
查看某个topic
[root@shtest01 ~]# /usr/lib/kafka/bin/./kafka-topics.sh --zookeeper localhost:2181/kafka --topic topictest03 --describe
Topic:topictest03 PartitionCount:1 ReplicationFactor:1 Configs:
Topic: topictest03 Partition: 0 Leader: 1001 Replicas: 1001 Isr: 1001