- 问题描述:
今天在使用shell脚本启动集群时,发现无法启动集群,在logs目录下只有一个kafkaServer.out文件,其中内容为:nohup: failed to run command `java’: No such file or directory
- 原本的shell脚本内容如下
#!/bin/bashcase $1 in
"start"){for i in hadoop002 hadoop003 hadoop004doecho "========== $i ==========" ssh $i "/opt/module/kafka/bin/kafka-server-start.sh -daemon /opt/module/kafka/config/server.properties"done};;"stop"){for i in hadoop002 hadoop003 hadoop004doecho "========== $i ==========" ssh $i "/opt/module/kafka/bin/kafka-server-stop.sh"done};;
esac
- 解决方法:
修改脚本
#!/bin/bashcase $1 in
"start"){for i in hadoop002 hadoop003 hadoop004doecho "========== $i ==========" ssh $i "source /etc/profile;nohup /opt/module/kafka/bin/kafka-server-start.sh -daemon /opt/module/kafka/config/server.properties"done};;"stop"){for i in hadoop002 hadoop003 hadoop004doecho "========== $i ==========" ssh $i "/opt/module/kafka/bin/kafka-server-stop.sh"done};;
esac
- 问题解决