1、ZooKeeper运行正常
2、KAFKA自带的kafka-server-start.sh脚本可以正常启动,kafka-server-stop.sh也可正常停止。
3、设置KAFKA的systemctl启动时失败,停止也失败
4、kafka-server-start.sh、kafka-server-stop.sh、kafka-server-stop.sh全部赋予777权限
5、下面是KAFKA的systemctl的配置文件
路径/usr/lib/systemd/system/kafka.service
内容如下
[Unit]
Description=kafka service
After=network.target remote-fs.target nss-lookup.target zookeeper.service
[Service]
Type=forking
ExecStart=/apps/kafka/bin/kafka-server-start.sh -daemon /apps/kafka/config/server.properties
ExecStop=/apps/kafka/bin/kafka-server-stop.sh
[Install]
WantedBy=multi-user.targe
启动报错如下
[root@King ~]# systemctl start kafka.service
[root@King ~]# systemctl status kafka.service
● kafka.service - kafka service
Loaded: loaded (/usr/lib/systemd/system/kafka.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since 六 2022-08-06 14:11:21 CST; 2s ago
Process: 7967 ExecStop=/apps/kafka/bin/kafka-server-stop.sh (code=exited, status=1/FAILURE)
Process: 7650 ExecStart=/apps/kafka/bin/kafka-server-start.sh -daemon /apps/kafka/config/server.properties (code=exited, status=0/SUCCESS)
Main PID: 7966 (code=exited, status=127)
8月 06 14:11:20 King systemd[1]: Starting kafka service...
8月 06 14:11:21 King systemd[1]: Started kafka service.
8月 06 14:11:21 King systemd[1]: kafka.service: main process exited, code=exited, status=127/n/a
8月 06 14:11:21 King kafka-server-stop.sh[7967]: No kafka server to stop
8月 06 14:11:21 King systemd[1]: kafka.service: control process exited, code=exited status=1
8月 06 14:11:21 King systemd[1]: Unit kafka.service entered failed state.
8月 06 14:11:21 King systemd[1]: kafka.service failed.