Skip to content

Instantly share code, notes, and snippets.

@dksifoua
Created September 23, 2019 11:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dksifoua/38a346c491c7fa28703f3140d30a5432 to your computer and use it in GitHub Desktop.
Save dksifoua/38a346c491c7fa28703f3140d30a5432 to your computer and use it in GitHub Desktop.
# Create a file /etc/systemd/system/zookeeper.service and add it this content
==============================================================================================
[Unit]
Requires=network.target remote-fs.target
After=network.target remote-fs.target
[Service]
Type=simple
User=dimitri_sifoua
ExecStart=/opt/kafka/bin/zookeeper-server-start.sh /opt/kafka/config/zookeeper.properties
ExecStop=/opt/kafka/bin/zookeeper-server-stop.sh
Restart=on-abnormal
[Install]
WantedBy=multi-user.target
==============================================================================================
# Create a file /etc/systemd/system/kafka.service and add it this content
==============================================================================================
[Unit]
Requires=zookeeper.service
After=zookeeper.service
[Service]
Type=simple
User=dimitri_sifoua
ExecStart=/bin/sh -c '/opt/kafka/bin/kafka-server-start.sh /opt/kafka/config/server.properties > /opt/kafka/kafka.log 2>&1'
ExecStop=/home/kafka/kafka/bin/kafka-server-stop.sh
Restart=on-abnormal
[Install]
WantedBy=multi-user.target
==============================================================================================
Now, we can start kafka with this command
$ sudo systemctl start kafka
To ensure that the server has started successfully, check the journal logs for the kafka unit:
$ sudo journalctl -u kafka
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment