Mac系統使用kafka

1、安裝工具brew install kafka 會自動安裝依賴zookeeper

2、安裝配置文件位置 /usr/local/etc/kafka|zookeeper

3、啓動 zookeeper

cd /usr/local/Cellar/kafka/2.0

./bin/zookeeper-server-start /usr/local/etc/kafka/zookeeper.properties &

4、啓動kafka服務

./bin/kafka-server-start /usr/local/etc/kafka/server.properties &

5、創建topic 

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

6、查看創建的topic

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

7、生產數據

./bin/kafka-console-producer --broker-list localhost:9092 --topic test1

8、消費數據

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

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章