Skip to content

Instantly share code, notes, and snippets.

@myleshk
Last active January 3, 2018 02:53
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 myleshk/21e3edae82a73a70c72271e18bd5b108 to your computer and use it in GitHub Desktop.
Save myleshk/21e3edae82a73a70c72271e18bd5b108 to your computer and use it in GitHub Desktop.
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
Copy link
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