Kafka Common Commands
The following is a summary of Kafka common command line:
1. View topic Details
./kafka-topics.sh-zookeeper 127.0.0.1:2181-describe-topic TestKJ1
2. Add a copy for topic
./kafka-reassign-partitions.sh-zookeeper 127.0.0.1:2181-reassignment-json-file Json/partitions-to-move.json- Execute
3. Create Topic
./kafka-topics.sh--create--zookeeper localhost:2181--replication-factor 1--partitions 1--topic testKJ1
4. Increase partition for topic
./bin/kafka-topics.sh–zookeeper 127.0.0.1:2181–alter–partitions 20–topic testKJ1
5. Kafka Producer Client Commands
./kafka-console-producer.sh--broker-list localhost:9092--topic testKJ1
6. Kafka Consumer Client Commands
./kafka-console-consumer.sh-zookeeper localhost:2181--from-beginning--topic testKJ1
7, Kafka service start
./kafka-server-start.sh-daemon. /config/server.properties
8. Downline Broker
./kafka-run-class.sh kafka.admin.ShutdownBroker--zookeeper 127.0.0.1:2181--broker #brokerId #--num.retries 3-- retry.interval.ms 60
Shutdown broker
9. Delete Topic
./kafka-run-class.sh Kafka.admin.DeleteTopicCommand--topic testKJ1--zookeeper 127.0.0.1:2181
./kafka-topics.sh--zookeeper localhost:2181--delete--topic testKJ1
10. Check the offset of consumption in consumer group
./kafka-run-class.sh kafka.tools.ConsumerOffsetChecker--zookeeper localhost:2181--group test--topic testKJ1
Learning Reference:
Http://www.infoq.com/cn/articles/kafka-analysis-part-1
http://flychao88.iteye.com/category/350737
http://shift-alt-ctrl.iteye.com/blog/1930791
Http://www.tuicool.com/articles/mErEZn