storm集群启动停止脚本

转载自:storm集群启动停止脚本

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 <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 <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 <source /etc/profile
        cd \$STORM_HOME
        bin/storm supervisor >/dev/null 2>&1 &
EOF
echo 从节点 $visor 启动supervisor...[ done ]
sleep 1
done
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43


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

你可能感兴趣的:(storm,脚本,Linux,脚本,Storm)