Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Run Kafka & Zookeeper & Luigid using systemd on Ubuntu 16.04
[Unit]
Description=Apache Zookeeper server (Kafka)
Documentation=http://zookeeper.apache.org
Requires=network.target remote-fs.target
After=network.target remote-fs.target
[Service]
Type=simple
User=kafka
Group=kafka
# Change the path in the following 2 lines if needed
ExecStart=/home/kafka/kafka/bin/zookeeper-server-start.sh /home/kafka/kafka/config/zookeeper.properties
ExecStop=/home/kafka/kafka/bin/zookeeper-server-stop.sh
[Install]
WantedBy=multi-user.target
[Unit]
Description=Apache Kafka server (broker)
Documentation=http://kafka.apache.org/documentation.html
Requires=network.target remote-fs.target
After=network.target remote-fs.target kafka-zookeeper.service
[Service]
Type=simple
User=kafka
Group=kafka
# Change the path in the following 2 lines if needed
ExecStart=/home/kafka/kafka/bin/kafka-server-start.sh /home/kafka/kafka/config/server.properties
ExecStop=/home/kafka/kafka/bin/kafka-server-stop.sh
[Install]
WantedBy=multi-user.target
[Unit]
Description=Spotify Luigi server
Documentation=https://luigi.readthedocs.io/en/stable/
Requires=network.target remote-fs.target
After=network.target remote-fs.target
[Service]
Type=simple
User=ubuntu
Group=ubuntu
# Change the path in the following 2 lines if needed
ExecStart=/home/ubuntu/ffi_pipeline/venv/bin/luigid
#ExecStop=
[Install]
WantedBy=multi-user.target
@myleshk

This comment has been minimized.

Copy link
Owner Author

myleshk commented Jan 2, 2018

  • Put these files in /lib/systemd/system

  • Use the systemctl command to enable the service:

sudo systemctl enable kafka-zookeeper
sudo systemctl enable kafka
sudo systemctl enable luigid

This will enable automatic starting after a reboot.

  • Reload the systemd daemon, followed by a restart of the service:
sudo systemctl daemon-reload

sudo systemctl restart kafka-zookeeper
sudo systemctl restart kafka
sudo systemctl restart luigid

Ref:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.