refer to: https://dtflaneur.wordpress.com/2015/10/05/installing-kafka-on-mac-osx/
安装
Run the cmd on terminal: brew install kafka
### 安装日志
➜ ~ brew install kafka
==> Installing dependencies for kafka: zookeeper
==> Installing kafka dependency: zookeeper
==> Downloading https://homebrew.bintray.com/bottles/zookeeper-3.4.7.yosemite.bottle.tar.gz
######################################################################## 100.0%
==> Pouring zookeeper-3.4.7.yosemite.bottle.tar.gz
==> Caveats
To have launchd start zookeeper at login:
ln -sfv /usr/local/opt/zookeeper/*.plist ~/Library/LaunchAgents
Then to load zookeeper now:
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.zookeeper.plist
Or, if you don't want/need launchctl, you can just run:
zkServer start
==> Summary
🍺 /usr/local/Cellar/zookeeper/3.4.7: 235 files, 18M
==> Installing kafka
==> Downloading http://mirrors.ibiblio.org/apache/kafka/0.8.2.2/kafka-0.8.2.2-src.tgz
######################################################################## 100.0%
==> gradle
==> gradle jar
==> Caveats
To start Kafka, ensure that ZooKeeper is running and then execute:
kafka-server-start.sh /usr/local/etc/kafka/server.properties
To have launchd start kafka at login:
ln -sfv /usr/local/opt/kafka/*.plist ~/Library/LaunchAgents
Then to load kafka now:
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.kafka.plist
==> Summary
🍺 /usr/local/Cellar/kafka/0.8.2.2: 3817 files, 38M, built in 6.9 minutes
启动
- ZK: zkserver start
- Kafka: kafka-server-start.sh /usr/local/etc/kafka/server.properties
测试
- Start a consumer: kafka-console-consumer.sh --zookeeper localhost:2181 --topic test --from-beginning
- Start a producer: kafka-console-producer.sh --broker-list localhost:9092 --topic test
- Sending a message in producer like: hello world
- You should see message printed on the terminal of consumer: hello world
Broker集群
TBD
停止
- ZK: zkserver stop
- Kafka: