目录
- 安装
- 启动
- 文件配置
- 测试启动
安装
前提条件,Java环境,zookeeper已经安装
brew install kafka
如图所示则安装成功
启动
brew提供了一键启动的方式
zookeeper-server-start /usr/local/etc/kafka/zookeeper.properties & kafka-server-start /usr/local/etc/kafka/server.properties
文件配置
测试启动
- 创建topic
kafka-topics –create –zookeeper localhost:2181 –replication-factor 1 –partitions 1 –topic test - 查看创建的topic
kafka-topics –list –zookeeper localhost:2181 发送一些消息
kafka-console-producer –broker-list localhost:9092 –topic test消费消息
kafka-console-consumer –bootstrap-server localhost:9092 –topic test –from-beginning