Mac下安装Kafka

  1. 安装命令
    $ brew install kafka
    Updating Homebrew...
    ==> Installing dependencies for kafka: zookeeper
    ==> Installing kafka dependency: zookeeper
    ==> Downloading https://homebrew.bintray.com/bottles/zookeeper-3.4.13.sierra.bottle.tar.gz
    ######################################################################## 100.0%
    ==> Pouring zookeeper-3.4.13.sierra.bottle.tar.gz
    ==> Caveats
    To have launchd start zookeeper now and restart at login:
      brew services start zookeeper
    Or, if you don't want/need a background service you can just run:
      zkServer start
    ==> Summary
      /usr/local/Cellar/zookeeper/3.4.13: 244 files, 33.4MB
    ==> Installing kafka
    ==> Downloading https://homebrew.bintray.com/bottles/kafka-2.1.0.sierra.bottle.tar.gz
    ######################################################################## 100.0%
    ==> Pouring kafka-2.1.0.sierra.bottle.tar.gz
    ==> Caveats
    To have launchd start kafka now and restart at login:
      brew services start kafka
    Or, if you don't want/need a background service you can just run:
      zookeeper-server-start /usr/local/etc/kafka/zookeeper.properties & kafka-server-start /usr/local/etc/kafka/server.properties
    ==> Summary
      /usr/local/Cellar/kafka/2.1.0: 164 files, 52.6MB
    ==> Caveats
    ==> zookeeper
    To have launchd start zookeeper now and restart at login:
      brew services start zookeeper
    Or, if you don't want/need a background service you can just run:
      zkServer start
    ==> kafka
    To have launchd start kafka now and restart at login:
      brew services start kafka
    Or, if you don't want/need a background service you can just run:
      zookeeper-server-start /usr/local/etc/kafka/zookeeper.properties & kafka-server-start /usr/local/etc/kafka/server.properties
    
  2. 配置文件路径
    /usr/local/etc/kafka/server.properties
    /usr/local/etc/kafka/zookeeper.properties
    
  3. Kafka 命令安装路径
     /usr/local/Cellar/kafka/2.1.0
    
  4. 启动Zookeeper
    cd /usr/local/Cellar/kafka/2.1.0
    ./bin/zookeeper-server-start /usr/local/etc/kafka/zookeeper.properties
    
  5. 启动Kafka
    cd /usr/local/Cellar/kafka/2.1.0
    ./bin/kafka-server-start /usr/local/etc/kafka/server.properties
    
  6. 创建Topic
    /usr/local/Cellar/kafka/2.1.0/bin $ ./kafka-topics --create --zookeeper localhost:2181 --		replication-factor 1 --partitions 1 --topic test-topic-1
    Created topic "test-topic-1".
    

你可能感兴趣的:(Java)