kafka 安装和使用测试(mac版)

来源:互联网 发布:大数据主要来源于哪些 编辑:程序博客网 时间:2024/06/10 03:12
1.确保已安装zookeeper(见zookeeper安装mac版本)
2.安装kafka,命令:brew install kafka
3.启动
zookeeper-server-start /usr/local/etc/kafka/zookeeper.properties
4.创建topic
kafka-topics --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test
5.查看创建的topic
kafka-topics --list --zookeeper localhost:2181
6。生产者生产数据
kafka-console-producer --broker-list localhost:9092 --topic test
7.消费者
kafka-console-consumer --bootstrap-server localhost:9092 --topic test --from-beginning