Kafka common command line details and collation
- 2020-05-14 05:52:45
- OfStack
Kafka common command line details and collation
Here is a summary of the common kafka command line:
1. To view topic details
./kafka-topics.sh -zookeeper 127.0.0.1:2181 -describe -topic testKJ1
2 And for the topic Add a copy of the
./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 And for the topic increase partition
./bin/kafka-topics.sh � zookeeper 127.0.0.1:2181 � alter � partitions 20 � topic testKJ1
5 , kafka Producer client command
./kafka-console-producer.sh --broker-list localhost:9092 --topic testKJ1
6 , kafka Consumer client command
./kafka-console-consumer.sh -zookeeper localhost:2181 --from-beginning --topic testKJ1
7 , kafka The service start
./kafka-server-start.sh -daemon ../config/server.properties
8 Rolled off the production line, 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 And check consumer Group consumption offset
./kafka-run-class.sh kafka.tools.ConsumerOffsetChecker --zookeeper localhost:2181 --group test --topic testKJ1
Thank you for reading, I hope to help you, thank you for your support of this site!