Created
September 23, 2019 11:49
-
-
Save dksifoua/38a346c491c7fa28703f3140d30a5432 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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