kafka MAC下的使用
安装的配置文件位置
/usr/local/etc/kafka/server.properties
/usr/local/etc/kafka/zookeeper.properties
启动zookeeper
./bin/zookeeper-server-start /usr/local/etc/kafka/zookeeper.properties &
启动 kafka 服务
cd /usr/local/Cellar/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 test
查看创建的topic
./bin/kafka-topics --list --zookeeper localhost:2181
生产者 生产消息
./bin/kafka-console-producer --broker localhost:9092 --topic test
消费者 消费消息
./bin/kafka-console-consumer --bootstrap-server localhost:9092 --topic test --from-beginning