Skip to content

Instantly share code, notes, and snippets.

@siliconsenthil
Last active November 30, 2022 15:15
Show Gist options
  • Save siliconsenthil/93e897a2955a260b9adca301fbb56ab0 to your computer and use it in GitHub Desktop.
Save siliconsenthil/93e897a2955a260b9adca301fbb56ab0 to your computer and use it in GitHub Desktop.
Install Kafka in Mac

Installation

brew tap adoptopenjdk/openjdk


brew cask install adoptopenjdk14
brew cask install homebrew/cask-versions/adoptopenjdk8

This is weird. The brew cask formula depends on homebrew/cask-versions/adoptopenjdk8. But the running zookeeper version requires adoptopenjdk14

Then install kafka

brew install kafka

The above will install kafka and it's dependency zookeeper

You can start both of them by,

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

OR preferably you can start in the background by

brew services start zookeeper
brew services start kafka

You can ensure those services started by,

brew services list

If the services have not started, look at the logs at

tail -f /usr/local/var/log/kafka/kafka_output.log

Local UI

There are bunch of options. One of them is Kafdrop. Download the latest release and you can run that locally with,

java --add-opens=java.base/sun.nio.ch=ALL-UNNAMED -jar ~/Downloads/kafdrop-3.27.0.jar

And visit http://localhost:9000/

Optional

One more optional tool to play with kafka (publishing, subscribing, metadata, etc.) is Kafkacat. Install with

brew install kafkacat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment