kafka群起脚本启动不了:nohup: failed to run command `java‘: No such file or directory

kafka群起脚本启动不了:nohup: failed to run command `java’: No such file or directory

原先脚本停止是可以的,但是启动不行启动不了:

#!/bin/bash

case $1 in
"start"){
    for i in hadoop102 hadoop103 hadoop104
    do
        echo " --------start $i Kafka-------"
        ssh $i "/opt/module/kafka_0.11.0/bin/kafka-server-start.sh -daemon /opt/module/kafka_0.11.0/config/server.properties"
    done
};;

"stop"){
   for i in hadoop102 hadoop103 hadoop104
   do
        echo "----------stop $i kafka---------"
        ssh $i "/opt/module/kafka_0.11.0/bin/kafka-server-stop.sh"
   done
};;

esac

修改后可以正常启动:

#!/bin/bash

case $1 in
"start"){
    for i in hadoop102 hadoop103 hadoop104
    do
        echo " --------start $i Kafka-------"
        ssh $i "source /etc/profile;nohup /opt/module/kafka_0.11.0/bin/kafka-server-start.sh -daemon /opt/module/kafka_0.11.0/config/server.properties >/dev/null 2>&1 &"
    done
};;

"stop"){
   for i in hadoop102 hadoop103 hadoop104
   do
        echo "----------stop $i kafka---------"
        ssh $i "source /etc/profile; /opt/module/kafka_0.11.0/bin/kafka-server-stop.sh"
   done
};;

esac

在启动kafka之前 先启动zookeeper,如果是zookeeper管理的话,不然也会启动不了。

你可能感兴趣的:(kafka,shell)