Kafka学习-第四篇 Kafka基本操作命令

1. 创建topic

bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic testTopic1

2. 查看已经创建的topic信息

bin/kafka-topics.sh --list --zookeeper localhost:2181

3. 生产者发送消息

bin/kafka-console-producer.sh --broker-list localhost:9092 --topic testTopic1
This is a message
This is another message

4. 消费者消费消息

bin/kafka-console-consumer.sh --bootstrap-server localhost:2181 --from-beginning --topic testTopic1
发布了40 篇原创文章 · 获赞 25 · 访问量 10万+

猜你喜欢

转载自blog.csdn.net/yym373872996/article/details/105654051