美文网首页
macOS下使用brew快速安装Kafka

macOS下使用brew快速安装Kafka

作者: bluexiii | 来源:发表于2018-05-30 10:06 被阅读510次

    安装

    brew install kafka
    

    如果缺少JDK8依赖,或安装了JDK10,则需要先通过brew cask插件安装JDK8:

    brew cask install java8
    

    安装位置

    /usr/local/Cellar/zookeeper
    /usr/local/Cellar/kafka
    

    配置文件位置

    /usr/local/etc/kafka/server.properties
    /usr/local/etc/kafka/zookeeper.properties
    

    启动

    直接启动:

    zookeeper-server-start /usr/local/etc/kafka/zookeeper.properties &
    kafka-server-start /usr/local/etc/kafka/server.properties &
    

    或通过brew services插件启动

    brew services start zookeeper
    brew services start kafka
    

    创建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
    

    附:brew services说明

    https://github.com/Homebrew/homebrew-services

    附:brew cask说明

    https://caskroom.github.io

    相关文章

      网友评论

          本文标题:macOS下使用brew快速安装Kafka

          本文链接:https://www.haomeiwen.com/subject/wihtsftx.html