Skip to content

Instantly share code, notes, and snippets.

@dcode
Created March 3, 2016 01:39
Show Gist options
  • Select an option

  • Save dcode/b4afe536e4325125688c to your computer and use it in GitHub Desktop.

Select an option

Save dcode/b4afe536e4325125688c to your computer and use it in GitHub Desktop.
Service files for kafka and zookeeper
[Unit]
Description=Kafka distributed logging server
Requires=zookeeper.service
After=zookeeper.service
[Service]
User=kafka
Group=kafka
SyslogIdentifier=kafka
Environment="KAFKA_LOG4J_OPTS=-Dlog4j.configuration=file:/opt/kafka/config/log4j.properties"
Environment="KAFKA_HEAP_OPTS=-Xmx1G -Xms1G -Djava.net.preferIPv4Stack=true -Dproc.name=kafka"
Environment="KAFKA_ARGS=-name kafkaServer -loggc"
Environment="KAFKA_PROPS=/opt/kafka/config/server.properties"
EnvironmentFile=-/etc/sysconfig/kafka
ExecStart=/opt/kafka/bin/kafka-run-class.sh kafka.Kafka ${KAFKA_PROPS}
[Install]
WantedBy=multi-user.targetc
[Unit]
Description=Zookeeper distributed coordination server
After=network.target
[Service]
User=zookeeper
Group=zookeeper
SyslogIdentifier=zookeeper
Environment="KAFKA_LOG4J_OPTS=-Dlog4j.configuration=file:/opt/kafka/config/log4j.properties"
Environment="KAFKA_HEAP_OPTS=-Xmx512M -Xmx512M -Djava.net.preferIPv4Stack=true -Dproc.name=zookeeper"
Environment="ZOOKEEPER_ARGS=-name zookeeper -loggc"
Environment="ZOOKEEPER_PROPS=/opt/kafka/config/zookeeper.properties"
EnvironmentFile=-/etc/sysconfig/zookeeper
ExecStart=/opt/kafka/bin/kafka-run-class.sh org.apache.zookeeper.server.quorum.QuorumPeerMain ${ZOOKEEPER_PROPS}
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment