Strom的集群停止以及启动

一:停止

1.概述

  关于strom没有停止命令

2.第一种方式(kill)

  jps之后

  使用bin/strom -kill wordcount

3.第二种方式(书写脚本)

4.先新建supervisorHost 

5.书写脚本

  

 #!/bin/bash

 STORM_HOME=/etc/opt/modules/storm-0.9.

 #.停止本机上的nimbus和ui进程

 kill - `ps -ef | grep daemon.nimbus | awk '{print $2}'|head -n `
kill - `ps -ef | grep ui.core | awk '{print $2}'|head -n ` #.停止supervisor节点上的supervisor和logviewer进程 supervisorHost=${STORM_HOME}/bin/supervisorHost
supervisors=$(cat $supervisorHost) for supervisor in $supervisors
do
echo "stop supervisor and logviewer in $supervisor"
ssh $supervisor "kill -9 `ssh $supervisor ps -ef | grep daemon.supervisor | awk '{print $2}'|head -n 1`" >/dev/null >&
ssh $supervisor "kill -9 `ssh $supervisor ps -ef | grep daemon.logviewer | awk '{print $2}'|head -n 1`" >/dev/null >&
done

二:启动

1.正常命令启动

2.新建supervisorHost

  方便寻找supervisor的pid

  Strom的集群停止以及启动

3.书写脚本

  

 #!/bin/bash

 STORM_HOME=/etc/opt/modules/storm-0.9.
#.在本机上启动nimbus和ui进程 nohup ${STORM_HOME}/bin/storm nimbus >/dev/null >& &
nohup ${STORM_HOME}/bin/storm ui >/dev/null >& & #.在指定作为Supervisor的服务器上启动supervisor和logviewer supervisorHost=${STORM_HOME}/bin/supervisorHost
supervisors=$(cat $supervisorHost) for supervisor in $supervisors
do
echo "start supervisor and logviewer in $supervisor"
ssh $supervisor "source /etc/profile && nohup ${STORM_HOME}/bin/storm supervisor >/dev/null 2>&1" >/dev/null >& &
ssh $supervisor "source /etc/profile && nohup ${STORM_HOME}/bin/storm logviewer >/dev/null 2>&1" >/dev/null >& &
done
上一篇:理解与使用Javascript中的回调函数


下一篇:理解与使用Javascript中的回调函数 -2