How to start & stop Zookeeper and Kafka servers from Commandline | Commands | Zookeeper | Kafka





In this blog, we will explain how to start Zookeeper and Apache Kafka services from command line using simple commands for Big Data environment.

Recently, I have done Kafka multi node cluster setup on RHEL 7.Once installation is completed successfully, then I tried to start Zookeeper and Kafka server from command line.

In any cluster, before start Apache Kafka. First, we need to start Zookeeper services, after that will start Kafka services.

How to start Zookeeper service from CLI

/etc/bin/zookeeper-server-start -daemon /etc/kafka/zookeeper.properties

Once started the Zookeeper server then, we will verify using below command:

ps -ef | grep 2181

Here we are trying to grep the Zookeeper services process id. If it is running fine, otherwise will check Zookeeper server log.




Step 2: After started the Zookeeper, then will start the Kafka server

How to start Kafka server from CLI

/etc/bin/kafka-server-start -daemon  /etc/kafka/server.properties

We need to verify the whether Kafka services using process command

ps -ef | grep 9092

How to stop Zookeeper server from CLI:

/etc/bin/zookeeper-server-stop -daemon /etc/kafka/zookeeper.properties

How to stop Kafka server from CLI:

/etc/bin/kafka-server-start -daemon  /etc/kafka/server.properties

After stopped all services, you will need to check whether services are stopped or not. The above process commands will help for stopping services.

Summary:

For Big Data environment, Apache Kafka is a major role in current projects for large data systems.  Before starting Kafka, we must and should start Zookeeper, without Zookeeper there is no Kafka server starts.Basically, Zookeeper is used for configurations, synchronization and group services over large data Hadoop clusters. Coming to Apache Kafka, it is a Streaming platform for message distribution in the Big Data clusters. Here we provided simple Zookeeper/Kafka daemons start with commands. After that we need to verify the services whether running or not in the command line.




The above commands are very simple for start & stop the Zookeeper and Kafka servers.