Kafka—topic query and creation

Record commonly used topic related commands commonly used by kafka

View topic list

[root@shtest01 ~]# /usr/lib/kafka/bin/./kafka-topics.sh --list --zookeeper localhost:2181/kafka

Create 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: Create command
--topic;: specify the topic name later;:
--replication-factorspecify the number of copies later;: specify the number of
--partitionspartitions, according to the number of brokers ;: zk link
--zookeeperspecified later zookeeper.connect;

View a 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

Published 118 original articles · Like 150 · Visits 40,000+

Guess you like

Origin blog.csdn.net/Andya_net/article/details/105118822