Kafka常用命令 以及zookeeper is not a recognized option解决方法

基本命令

创建topic

./bin/kafka-topics.sh --create --bootstrap-server localhost:9092 --replication-factor 1 --partitions 1 --topic codesheep

查看已有的topic

./bin/kafka-topics.sh --list --bootstrap-server localhost:9092

创建生产者

./bin/kafka-console-producer.sh --bootstrap-server localhost:9092 --topic codesheep

创建消费者

./bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic codesheep

查看topic里的数据出现问题

zookeeper is not a recognized option
在这里插入图片描述
这是因为–zookeeper是一个过时的方法,此时,才知道原来在最新的版本中,这种启动方式已经被删除了。

新版本的启动方法

./bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic codesheep --from-beginning

猜你喜欢

转载自blog.csdn.net/qq_36905956/article/details/106416380