storm叢集啟動停止指令碼

兵工廠三劍客發表於2018-06-07

轉載自: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 <<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
  • 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

相關文章