systemctl管理kafka和zookeeper

/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-reload

systemctl start kafka

systemctl start zookeeper

systemctl status kafka

systemctl status zookeeper

相关推荐
小韩学长yyds4 小时前
从入门到精通:RabbitMQ的深度探索与实战应用
分布式·rabbitmq
费曼乐园8 小时前
Zookeeper启动指定JDK版本
zookeeper
问道飞鱼10 小时前
【分布式知识】Spring Cloud Gateway实现跨集群应用访问
分布式·eureka·gateway
费曼乐园10 小时前
Kafka中bin目录下面kafka-run-class.sh脚本中的JAVA_HOME
java·kafka
Shinobi_Jack10 小时前
c#使用Confluent.Kafka实现生产者发送消息至kafka(远程连接kafka发送消息超时的解决 Local:Message timed out)
分布式·kafka
S-X-S11 小时前
RabbitMQ的消息可靠性保证
分布式·rabbitmq
小林想被监督学习16 小时前
RabbitMQ 在实际应用时要注意的问题
分布式·rabbitmq
S-X-S16 小时前
项目集成RabbitMQ
分布式·rabbitmq
DA022116 小时前
Win10系统部署RabbitMQ Server
分布式·rabbitmq
费曼乐园18 小时前
Kafka与ZooKeeper
zookeeper·kafka