* 安裝(會自動依賴安裝zookeeper)```shellbrew install kafka ```* 啟動zookeeper```shellcd /usr/local/Cellar/kafka/2.1.1/bin/./zookeeper-server-start /usr/local/etc/... ...
- 安裝(會自動依賴安裝zookeeper)
brew install kafka
- 啟動zookeeper
cd /usr/local/Cellar/kafka/2.1.1/bin/
./zookeeper-server-start /usr/local/etc/kafka/zookeeper.properties &
- 啟動kafka
./kafka-server-start /usr/local/etc/kafka/server.properties &
- 查看配置文件
cd /usr/local/etc/kafka/
cd /usr/local/etc/zookeeper/
- 創建topic
kafka-topics --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic sunday
- 查看topic列表
kafka-topics --list --zookeeper localhost:2181
- 發送消息
kafka-console-producer --broker-list localhost:9092 --topic test
- 接收消息
kafka-console-consumer --bootstrap-server localhost:9092 --topic test --from-beginning