Kafka系列二- Kafka安装及测试
安装
- brew安装
- 安装配置文件位置 /usr/local/etc/kafka|zookeeper
- 启动 zookeeper
cd /usr/local/Cellar/kafka/0.10.0.1
./bin/zookeeper-server-start /usr/local/etc/kafka/zookeeper.properties &
- 启动kafka服务
./bin/kafka-server-start /usr/local/etc/kafka/server.properties &
- 创建topic
./bin/kafka-topics --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test1
- 查看创建的topic
./bin/kafka-topics --list --zookeeper localhost:2181
- 生产数据
./bin/kafka-console-producer --broker-list localhost:9092 --topic test1
- 消费数据
./bin/kafka-console-consumer.sh --zookeeper localhost:2181 --topic test1--from-beginning