首页 > 其他分享 >使用systemctl启动kafka

使用systemctl启动kafka

时间:2022-12-01 18:02:19浏览次数:38  
标签:opt target 启动 zookeeper server systemctl kafka


kafka依赖于zookeeper

1.新建zookeeper配置文件:

​vim ​​​​/etc/systemd/system/zookeeper​​​​.service​

​[Unit]​

​Description=Apache Zookeeper server​

​Documentation=http:​​​​//zookeeper​​​​.apache.org​

​Requires=network.target remote-fs.target​

​After=network.target remote-fs.target​

 

​[Service]​

​Type=simple​

​ExecStart=​​​​/opt/kafka/bin/zookeeper-server-start​​​​.sh ​​​​/opt/kafka/config/zookeeper​​​​.properties​

​ExecStop=​​​​/opt/kafka/bin/zookeeper-server-stop​​​​.sh​

​Restart=on-abnormal​

​User=root​

​Group=root​

 

​[Install]​

​WantedBy=multi-user.target​

2.启动zookeeper

输入命令:

​sudo​​​ ​​systemctl start zookeeper​

​sudo​​​ ​​systemctl status zookeeper​

3.新建kafka配置文件:

​vim ​​​​/etc/systemd/system/kafka​​​​.service​

​[Unit]​

​Description=Apache Kafka Server​

​Documentation=http:​​​​//kafka​​​​.apache.org​​​​/documentation​​​​.html​

​Requires=zookeeper.service​

 

​[Service]​

​Type=simple​

​ExecStart=​​​​/opt/kafka/bin/kafka-server-start​​​​.sh ​​​​/opt/kafka/config/server​​​​.properties​

​ExecStop=​​​​/opt/kafka/bin/kafka-server-stop​​​​.sh​

​Restart=on-abnormal​

 

 

​[Install]​

​WantedBy=multi-user.target​

4.启动kafka

输入命令:

​sudo​​​ ​​systemctl start kafka​

​sudo​​​ ​​systemctl status kafka​

标签:opt,target,启动,zookeeper,server,systemctl,kafka
From: https://blog.51cto.com/u_15899033/5903548

相关文章