mac下kafka环境搭建 测试

1、安装工具brew install kafka 会自动安装依赖zookeeper

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

3、启动 zookeeper

```

cd /usr/local/Cellar/kafka/0.10.0.1

./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.sh --zookeeper localhost:2181 --topic test1--from-beginning

推荐阅读更多精彩内容