LoginSignup
3
3

More than 1 year has passed since last update.

MacにKafkaをhomebrewを使ってインストールする

Last updated at Posted at 2018-06-23

概要

MacにKafkaをhomebrewインストールする手順

インストールされるKafkaのversionは、現時点で1.1.0になっています。

手順

インストール

$ brew install kafka

zookeeper起動

kafkaを入れるとzookeeperも入っている(はず)

brew services start zookeeper

kafka起動

brew services start kafka

確認

kafka-topicsがPATHに設定されている

$ which kafka-topics
/usr/local/bin/kafka-topics
$ ls -l /usr/local/bin/kafka-topics
lrwxr-xr-x  1 gosshys  admin  38  6 23 09:04 /usr/local/bin/kafka-topics -> ../Cellar/kafka/1.1.0/bin/kafka-topics

トピックのリストを見る

kafka-topics --list --zookeeper localhost:2181

トピックを作る

@shallowell さんに教えてもらった最近の方法

「--zookeeper は今はDeprecatedなので、以下のコマンドが良さそうです」

kafka-topics --create --bootstrap-server localhost:9092 --replication-factor 1 --partitions 1 --topic test

※3年前のコマンド(ご参考)

$ kafka-topics --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test
Created topic "test".
$ kafka-topics --describe --zookeeper localhost:2181 --topic test
Topic:test  PartitionCount:1    ReplicationFactor:1 Configs:
    Topic: test Partition: 0    Leader: 0   Replicas: 0 Isr: 0
3
3
4

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3