How to quickly install and start Kafka

362 Uncategorized Leave a Comment

Install and start Kafka is quite simple even on you local computer.

Maybe you are thinking it must need lots of dependencies, but the fact is, it only needs Java.

No database, no complicate configuration are needed, so you also no need to install Docker to run it.

How to install and start Kafka

Following are some simple steps about How to quickly install and start Kafka.

Note: please make sure your local environment have installed Java 8+

  1. Download Kafka binary tgz package from Kafka download page
  2. Unzip it:
    $ tar -xzf kafka_2.13-3.2.0.tgz
    $ cd kafka_2.13-3.2.0
  3. Because Kafka depends on zookeeper, so we should start zookeeper before Kafka:
    $ bin/ config/

    Note: Soon, ZooKeeper will no longer be required by Apache Kafka.

  4. Edit config/ file:
    $ vim config/

    Change following line:



  5. Start Kafka:
    $ bin/ config/

    Then Kafka will start on 9092 port.

  6. Test it, produce some messages:
    $ bin/ --bootstrap-server localhost:9092 --topic test_topic
    >test message 1
    >test message 2

    Consume the messages:

    $ bin/ --bootstrap-server localhost:9092 --topic test_topic
    test message 1
    test message 2


  1. Error connecting to node … No route to host

Detail issue is:

[2022-05-25 16:28:22,997] WARN [Controller id=0, targetBrokerId=0] Error connecting to node (id: 0 rack: null) (org.apache.kafka.clients.NetworkClient) No route to host
    at java.base/ Method)
    at java.base/
    at java.base/
    at java.base/
    at org.apache.kafka.clients.NetworkClient.initiateConnect(
    at org.apache.kafka.clients.NetworkClient.ready(
    at org.apache.kafka.clients.NetworkClientUtils.awaitReady(
    at kafka.controller.RequestSendThread.brokerReady(ControllerChannelManager.scala:291)
    at kafka.controller.RequestSendThread.doWork(ControllerChannelManager.scala:245)

To solve it, we should change following configuration as STEP 4 above:




Leave a Reply

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

Name *