Installing Apache Kafka on Mac

Pre – requistits

To install Apache Kafka on Mac, Java is the only prerequisite.

java -version

Step 1: Download binaries

Download the latest Apache Kafka from [https://kafka.apache.org/downloads] under Binary downloads.

Step 2: Extract the tgz file

Step 3: Start Zookeeper

Apache Kafka depends on Zookeeper for cluster management. Hence, prior to starting Kafka, Zookeeper has to be started. There is no need to explicitly install Zookeeper, as it comes included with Apache Kafka.

From the root of Apache Kafka, run the following command to start Zookeeper :

~$ sh bin/zookeeper-server-start.sh config/zookeeper.properties

Once you run above command you will see output like this:

[2021-12-19 17:35:32,469] INFO  (org.apache.zookeeper.server.ZooKeeperServer)
[2021-12-19 17:35:40,924] INFO Server  environment:zookeeper.version=3.6.3--6401e4ad2087061bc6b9f80dec2d69f2e3c8660a, built on 04/08/2021 16:35 GMT (org.apache.zookeeper.server.ZooKeeperServer)
[2021-12-19 17:35:40,924] INFO Server environment:host.name=192.168.1.24 (org.apache.zookeeper.server.ZooKeeperServer)
[2021-12-19 17:35:40,925] INFO Server environment:java.version=1.8.0_292 (org.apache.zookeeper.server.ZooKeeperServer)
[2021-12-19 17:35:40,925] INFO Server environment:java.vendor=AdoptOpenJDK (org.apache.zookeeper.server.ZooKeeperServer)
[2021-12-19 17:35:40,925] INFO Server environment:java.home=/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/jre (org.apache.zookeeper.server.ZooKeeperServer)
Advertisement

Step 4: Start Apache Kafka Server

Using an additional tab on the terminal run the below command

~$ sh bin/kafka-server-start.sh config/server.properties

You should see output like:

[2021-12-20 00:25:23,807] INFO [SocketServer listenerType=ZK_BROKER, nodeId=0] Starting socket server acceptors and processors (kafka.network.SocketServer)

[2021-12-20 00:25:23,817] INFO [SocketServer listenerType=ZK_BROKER, nodeId=0] Started data-plane acceptor and processor(s) for endpoint : ListenerName(PLAINTEXT) (kafka.network.SocketServer)

[2021-12-20 00:25:23,818] INFO [SocketServer listenerType=ZK_BROKER, nodeId=0] Started socket server acceptors and processors (kafka.network.SocketServer)

[2021-12-20 00:25:23,830] INFO Kafka version: 3.0.0 (org.apache.kafka.common.utils.AppInfoParser)

[2021-12-20 00:25:23,830] INFO Kafka commitId: 8cb0a5e9d3441962 (org.apache.kafka.common.utils.AppInfoParser)

[2021-12-20 00:25:23,830] INFO Kafka startTimeMs: 1639940123818 (org.apache.kafka.common.utils.AppInfoParser)

[2021-12-20 00:25:23,833] INFO [KafkaServer id=0] started (kafka.server.KafkaServer)

Advertisement

Leave a Reply

Your email address will not be published. Required fields are marked *

5 × 4 =