安装kafka
brew install kafka
启动Kafka
brew services start zookeeper
brew services start kafka
如果不懂 可以查看以下命令
kafka-topics --help
创建一个topic
kafka-topics --create --bootstrap-server localhost:9092 --partitions 1 --replication-factor 1 --topic test
查看topic
kafka-topics --list --bootstrap-server localhost:9092
新开一个窗口 建立生产者
kafka-console-producer --bootstrap-server localhost:9092 --topic test
新开一个窗口 建立消费者
kafka-console-consumer --bootstrap-server localhost:9092 --topic test
[
这篇博客介绍了如何通过Homebrew在Mac上安装Kafka和Zookeeper,并创建及管理Kafka的topics。步骤包括安装Kafka,启动Zookeeper和Kafka服务,创建和列出topics,以及设置生产者和消费者进行消息传递。
517

被折叠的 条评论
为什么被折叠?



