Kafka Cluster Management

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.