一:停止
1.概述
关于strom没有停止命令
2.第一种方式(kill)
jps之后
使用bin/strom -kill wordcount
3.第二种方式(书写脚本)
4.先新建supervisorHost
5.书写脚本
1 #!/bin/bash 2 3 STORM_HOME=/etc/opt/modules/storm-0.9.6 4 5 #1.停止本机上的nimbus和ui进程 6 7 kill -9 `ps -ef | grep daemon.nimbus | awk '{print $2}'|head -n 1` 8 kill -9 `ps -ef | grep ui.core | awk '{print $2}'|head -n 1` 9 10 11 12 #2.停止supervisor节点上的supervisor和logviewer进程 13 14 supervisorHost=${STORM_HOME}/bin/supervisorHost 15 supervisors=$(cat $supervisorHost) 16 17 for supervisor in $supervisors 18 do 19 echo "stop supervisor and logviewer in $supervisor" 20 ssh $supervisor "kill -9 `ssh $supervisor ps -ef | grep daemon.supervisor | awk '{print $2}'|head -n 1`" >/dev/null 2>&1 21 ssh $supervisor "kill -9 `ssh $supervisor ps -ef | grep daemon.logviewer | awk '{print $2}'|head -n 1`" >/dev/null 2>&1 22 done
二:启动
1.正常命令启动
2.新建supervisorHost
方便寻找supervisor的pid
3.书写脚本
1 #!/bin/bash 2 3 4 STORM_HOME=/etc/opt/modules/storm-0.9.6 5 #1.在本机上启动nimbus和ui进程 6 7 nohup ${STORM_HOME}/bin/storm nimbus >/dev/null 2>&1 & 8 nohup ${STORM_HOME}/bin/storm ui >/dev/null 2>&1 & 9 10 #2.在指定作为Supervisor的服务器上启动supervisor和logviewer 11 12 supervisorHost=${STORM_HOME}/bin/supervisorHost 13 supervisors=$(cat $supervisorHost) 14 15 for supervisor in $supervisors 16 do 17 echo "start supervisor and logviewer in $supervisor" 18 ssh $supervisor "source /etc/profile && nohup ${STORM_HOME}/bin/storm supervisor >/dev/null 2>&1" >/dev/null 2>&1 & 19 ssh $supervisor "source /etc/profile && nohup ${STORM_HOME}/bin/storm logviewer >/dev/null 2>&1" >/dev/null 2>&1 & 20 done