Last active
February 17, 2021 05:10
-
-
Save kwilczynski/6c6645dfdc8de4cd9ed1 to your computer and use it in GitHub Desktop.
kafka.service for systemd
This file contains 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
[Unit] | |
Description=Apache Kafka server (broker) | |
Documentation=http://kafka.apache.org/documentation.html | |
Requires=network.target remote-fs.target syslog.target | |
After=network.target remote-fs.target syslog.target | |
ConditionPathExists=/etc/kafka/server.properties | |
ConditionPathExists=/var/lib/kafka | |
[Service] | |
Type=simple | |
PIDFile=/var/run/kafka.pid | |
User=kafka | |
Group=kafka | |
WorkingDirectory=/var/lib/kafka | |
EnvironmentFile=/etc/sysconfig/kafka | |
ExecStart= | |
ExecStop= | |
Restart=on-failure | |
SyslogIdentifier=kafka | |
[Install] | |
WantedBy=multi-user.target |
@gianluca-sabena thank you for pointing this out! And for taking the time to comment, you are awesome!
Note: I have updated the gist as per your comment 👍
@kwilczynski what do you use as "ExecStart"? I'm using right know the java + classpath + java options and kinda works but I can't leverage EnvironmentFile this way (I'm on Debian and using /etc/default/kafka as EnvironmentFile)
@vide why you can't leverage EnvironmentFile? It should expose anything you put there to ExecStart for you to use.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Use Type=simple instead of forking otherwise systemd will throw a timeout error. See http://stackoverflow.com/questions/28776520/systemd-service-for-jar-file-gets-operation-timed-out-error-after-few-minues-o