Skip to content

Instantly share code, notes, and snippets.

@bfleming-ciena
Created July 11, 2017 18:21
Show Gist options
  • Save bfleming-ciena/4f9149fd40b9cba3c4e19952b1df0f72 to your computer and use it in GitHub Desktop.
Save bfleming-ciena/4f9149fd40b9cba3c4e19952b1df0f72 to your computer and use it in GitHub Desktop.
systemd service for kafka that uses environment settings in-line
[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
[Service]
Type=simple
PIDFile=/var/run/kafka.pid
User=kafka
Group=kafka
LimitNOFILE=300000
LimitFSIZE=infinity
Environment="JMX_PORT=9999"
Environment="KAFKA_HEAP_OPTS=-Xms4g -Xmx4g"
Environment="KAFKA_JVM_PERFORMANCE_OPTS=-XX:PermSize=48m -XX:MaxPermSize=48m -XX:+UseG1GC -XX:MaxGCPauseMillis=20 -XX:InitiatingHeapOccupancyPercent=35"
ExecStart=/opt/kafka/bin/kafka-server-start.sh /opt/kafka/config/server.properties
ExecStop=/opt/kafka/bin/kafka-server-stop.sh
Restart=on-failure
SyslogIdentifier=kafka
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment