Starting Kafka Server Permanently

26,642

Solution 1

nohup is required at the beginning of command, so that output is not on screen, but in file. Also & is required at the end of command to start the server in background:

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

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

will change to:

nohup bin/zookeeper-server-start.sh config/zookeeper.properties &

nohup bin/kafka-server-start.sh config/server.properties &

Solution 2

This is now officially supported in kafka and zookeeper startup scripts. So if you are on latest (Since Aug 2015) kafka you can use -daemon as follows.

# ./kafka-server-start.sh
USAGE: ./kafka-server-start.sh [-daemon] server.properties

# ./zookeeper-server-start.sh
USAGE: ./zookeeper-server-start.sh [-daemon] zookeeper.properties

Solution 3

Try bin/kafka-server-start.sh -daemon config/server.properties.

OR:

Try upstart script here:upstart script for kafka

Share:
26,642
user1058797
Author by

user1058797

Updated on July 09, 2022

Comments

  • user1058797
    user1058797 almost 2 years

    I have setup Kafka on Amazon EC2 instance.

    I have done the following in below order: (1) SSH into the Instance (2) Start Zookeper (3) Start Kafka (4) Execute Producer and Consumer Programs.

    Everything is working fine till here. However once I close the SSH window on which I have started Kafka, the Kafka service stops. I can no longer execute Producer and Consumer programs.

    How can I have the Kafka Server permanently up for all requests, even after I close the SSH window.

    Thank You.