Kafka命令行常用命令
1.查看topic
bin/kafka-topics.sh --zookeeper hadoop102:2181 --list
2.创建topic(–replication-factor : 副本数, --partitions: 分区数)
bin/kafka-topics.sh --zokeeper hadoop102:2181 --create --replication-factor 3 --partitions 1 --topic test
3.删除topic
bin/kafka-topics.sh --zookeeper hadoop102:2181 --delete --topic test
4.生产者发送消息
bin/kafka-console-producer.sh --broker-list hadoop102:9092 --topic test
5.消费者消费消息
bin/kafka-console-consumer.sh --bootstrap-server hadoop102:9092 --topic test
6.查看某个topic详情
bin/kafka-topics.sh --zookeeper hadoop102:2181 --describe --topic test
7.修改分区数
bin/kafka-topics.sh --zookeeper hadoop102:2181 --alter --topic test --partitions 6