版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/csdncjh/article/details/79791847
//新建topic
bin/kafka-topics.sh --create --zookeeper node:2181 --topic test --partitions 2 --replication-factor 1
//修改partition数 只能增
./bin/kafka-topics.sh --alter --topic test2 --zookeeper node:2181 --partitions 3
//删除topic
bin/kafka-topics.sh --delete --topic test --zookeeper node:2181
//查看topic列表
bin/kafka-topics.sh --list --zookeeper node:2181
//查看消费情况
./bin/kafka-run-class.sh kafka.tools.ConsumerOffsetChecker --zookeeper node:2181 --group jd-group4 --topic test2
//启动生产者
bin/kafka-console-consumer.sh --topic test6 --zookeeper node:2181
//启动消费者
bin/kafka-console-producer.sh --topic test6 --broker-list node:9092
//从头开始消费
bin/kafka-console-consumer.sh --zookeeper node:2181 --topic test --from-beginning