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

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