Kafka version 0.8.1-0.8.2
First, create the topic template:
/usr/hdp/2.2.0.0-2041/kafka/bin/kafka-topics.sh--create--zookeeper ip:2181--replication-factor 2--partitions 30 --topic TEST
Second, delete the topic Template: (Specify all zookeeper server IPs)
/usr/hdp/2.2.0.0-2041/kafka/bin/kafka-run-class.sh kafka.admin.DeleteTopicCommand--topic name--zookeeper IP01 : 2181,ip02:2181,ip03:2181
Third, depicting Kafka topic partion Information:/usr/hdp/2.2.0.0-2041/kafka/bin/kafka-topics.sh--DESCR Ibe--zookeeper ip:2181/usr/hdp/2.2.0.0-2041/kafka/bin/kafka-topics.sh--describe--zookeeper IP:2181--topic TE St
Iv. List Topic Information:
/usr/hdp/2.2.0.0-2041/kafka/bin/kafka-topics.sh--list--zookeeper ip:2181/usr/hdp/2.2.0.0-2041/kafka/bin/kafka- topics.sh--list--zookeeper ip:2181--topic TEST
Five, modify topic partition (the number of partitions can only increase can not be reduced)
/usr/hdp/2.2.0.0-2041/kafka/bin/kafka-topics.sh--alter--topic TEST--partitions--zookeeper IP:2181
Vi. bulk deletion of topic scripts
For i in '/usr/hdp/2.2.0.0-2041/kafka/bin/kafka-topics.sh--list--zookeeper ip:2181 ';d o/usr/hdp/2.2.0.0-2041/kafka/ bin/kafka-run-class.sh kafka.admin.DeleteTopicCommand--topic $i--zookeeper ip:2181,ip:2181,ip:2181
Done
After deleting topic, you need to delete the zookeeper file manually
[Email protected] bin]# Cd/usr/hdp/2.2.0.0-2041/zookeeper/bin
echo "Rmr/admin" |./zkcli.sh
echo "Rmr/consumers" |./zkcli.sh
echo "Rmr/config" |./zkcli.sh
echo "Rmr/controller" |./zkcli.sh
echo "Rmr/brokers" |./zkcli.sh
echo "Rmr/controller_epoch" |./zkcli.sh
Eight, the current Kafka version 0.8.1 delete topic at the same time, will not delete the corresponding directory files, need to manually delete. It is said that 0.90 of the version can be synchronized delete, untested, have tested friends welcome message exchange. Point out the lack of documentation, I will continue to improve.
Kafka Cluster Management