storm集群启动/停止脚本

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/zz657114506/article/details/54429965

storm集群启动脚本

    在$STORM_HOME/bin下touch start-storm-cluster.sh并chmod a+x start-storm-cluster.sh

#!/bin/bash
#nimbus节点
nimbusServers='mini01 mini02'

#supervisor节点
supervisorServers='mini01 mini02 mini03'

#启动所有的nimbus
for nim in $nimbusServers
do
    ssh -T $nim <<EOF
        source /etc/profile
        cd \$STORM_HOME
        bin/storm nimbus >/dev/null 2>&1 &
EOF
echo 从节点 $nim 启动nimbus...[ done ]
sleep 1
done

#启动所有的ui
for u in $nimbusServers
do
    ssh -T $u <<EOF
        source /etc/profile
        cd \$STORM_HOME
        bin/storm ui >/dev/null 2>&1 &
EOF
echo 从节点 $u 启动ui...[ done ]
sleep 1
done

#启动所有的supervisor
for visor in $supervisorServers
do
    ssh -T $visor <<EOF
        source /etc/profile
        cd \$STORM_HOME
        bin/storm supervisor >/dev/null 2>&1 &
EOF
echo 从节点 $visor 启动supervisor...[ done ]
sleep 1
done


storm集群停止脚本

    在$STORM_HOME/bin下touch stop-storm-cluster.sh并chmod a+x stop-storm-cluster.sh

#!/bin/bash

#nimbus节点
nimbusServers='mini01 mini02'

#supervisor节点
supervisorServers='mini01 mini02 mini03'

#停止所有的nimbus和ui
for nim in $nimbusServers
do
    echo 从节点 $nim 停止nimbus和ui...[ done ]
    ssh $nim "kill -9 `ssh $nim ps -ef | grep nimbus | awk '{print $2}'| head -n 1`" >/dev/null 2>&1
    ssh $nim "kill -9 `ssh $nim ps -ef | grep core | awk '{print $2}'| head -n 1`" >/dev/null 2>&1
done

#停止所有的supervisor
for visor in $supervisorServers
do
    echo 从节点 $visor 停止supervisor...[ done ]
    ssh $visor "kill -9 `ssh $visor ps -ef | grep supervisor | awk '{print $2}'| head -n 1`" >/dev/null 2>&1
done
展开阅读全文

没有更多推荐了,返回首页