/usr/lib/systemd/system/kafka.service
[Unit]
Description=Kafka Server Service
After=network.target
[Service]
Type=forking
User=tmn
Group=tmn
KillMode=control-group
Environment="JAVA_HOME=/opt/soft/jdk/jdk1.8.0_181"
ExecStart=/opt/soft/kafka/kafka_2.12-2.2.2/bin/kafka-server-start.sh -daemon /opt/soft/kafka/kafka_2.12-2.2.2/config/server.properties
ExecStop=/opt/soft/kafka/kafka_2.12-2.2.2/bin/kafka-server-stop.sh
ExecReload=/bin/kill -s HUP $MAINPID
SuccessExitStatus=0 143
PrivateTmp=false
LimitNOFILE=1000000
LimitNPROC=100000
TimeoutStopSec=10s
Restart=on-failure
RestartSec=30
[Install]
WantedBy=multi-user.target
/usr/lib/systemd/system/zookeeper.service
[Unit]
Description=Zookeeper Service
After=network.target
[Service]
Type=forking
User=tmn
Group=tmn
KillMode=control-group
Environment="JAVA_HOME=/usr/java/default"
ExecStart=/opt/soft/apache-zookeeper-3.5.9-bin/bin/zkServer.sh start
ExecStop=/opt/soft/apache-zookeeper-3.5.9-bin/bin/zkServer.sh stop
ExecReload=/opt/soft/apache-zookeeper-3.5.9-bin/bin/zkServer.sh restart
SuccessExitStatus=0 143
PrivateTmp=false
LimitNOFILE=1000000
LimitNPROC=100000
TimeoutStopSec=10s
Restart=on-failure
RestartSec=30
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reloadsystemctl start kafka
systemctl start zookeeper
systemctl status kafka
systemctl status zookeeper