安装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
[