Kafka common commands and zookeeper is not a recognized option solutions

Basic command

Create topic

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

View existing topics

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

Create producer

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

Create consumers

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

There is a problem with the data in the topic

zookeeper is not a recognized option.
Insert picture description here
This is because – zookeeper is an outdated method. At this time, I know that in the latest version, this startup method has been deleted.

How to start the new version

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

Guess you like

Origin blog.csdn.net/qq_36905956/article/details/106416380