整理kafka相關的常用命令


創建主題(4個分區,2個副本)
bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 2 --partitions 4 --topic test 
查詢集群描述
bin/kafka-topics.sh --describe --zookeeper 
生產者
bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test 
消費者
bin/kafka-console-consumer.sh --zookeeper localhost:2181 --topic test 
新生產者(支持0.9版本+)
bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test --producer.config config/producer.properties 
新消費者(支持0.9版本+)
bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic test --new-consumer --from-beginning --consumer.config config/consumer.properties 
新消費者列表查詢(支持0.9版本+)
bin/kafka-consumer-groups.sh --new-consumer --bootstrap-server localhost:9092 --list 
顯示某個消費組的消費詳情(僅支持offset存儲在zookeeper上的)
bin/kafka-run-class.sh kafka.tools.ConsumerOffsetChecker --zkconnect localhost:2181 --group test 
顯示某個消費組的消費詳情(支持0.9版本+)
bin/kafka-consumer-groups.sh --new-consumer --bootstrap-server localhost:9092 --describe --group test-consumer-group 
平衡leader
bin/kafka-preferred-replica-election.sh --zookeeper zk_host:port/chroot 
kafka自帶壓測命令
bin/kafka-producer-perf-test.sh --topic test --num-records 100 --record-size 1 --throughput 100 --producer-props bootstrap.servers=localhost:9092 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM