标签:ati 添加 this mon his grep while 集群 文件
x
#!/bin/bash# 1 声明#--------------------------------------#请在strom/bin/下执行脚本#supervisor-hosts:配置supervisor的主机名,请自行配置#BASH_PATH 需要自行配置#--------------------------------------BASH_PATH=/root/apps/storm-1.1.1cd $BASH_PATH/bin# 2 创建启动脚本文件touch start-supervisor.shtouch start-storm.shtouch stop-supervisor.shtouch stop-storm.shtouch supervisor-hosts# 3 赋予执行权限chmod +x *.sh# 4 start-supervisor.shcat>start-supervisor.sh<<EOF#!/bin/bash$BASH_PATH/bin/storm supervisor >/dev/null 2>&1 &EOF# 5 start-storm.shcat>start-storm.sh<<EOF#!/bin/bash$BASH_PATH/bin/storm nimbus >/dev/null 2>&1 &$BASH_PATH/bin/storm ui >/dev/null 2>&1 &cat $BASH_PATH/bin/supervisor-hosts | while read supervisordo echo "\$supervisor is start..." ssh \$supervisor $BASH_PATH/bin/start-supervisor.sh &doneEOF# 6 stop-supervisor.shcat>stop-supervisor.sh<<EOF#!/bin/bashkill -9 `ps -ef|grep daemon.supervisor| awk ‘{print $2}‘`# 选择是否清除工作目录文件#rm -rf /software/storm/workdir/*EOF# 7 stop-storm.shcat>stop-storm.sh<<EOF#!/bin/bashkill -9 `ps -ef|grep daemon.nimbus| awk ‘{print $2}‘`kill -9 `ps -ef|grep ui.core| awk ‘{print $2}‘`cat $BASH_PATH/bin/supervisor-hosts | while read supervisordo echo "\$supervisor is stop ..." ssh \$supervisor $BASH_PATH/bin/stop-supervisor.sh &doneEOF# 8 supervisor-hostscat>supervisor-hosts<<EOFmini1mini2mini3EOF# 1 将上文编辑好的start-supervisor和stop-supervisor脚本复制到所有节点相同路径下scp *-supervisor.sh mini2:$PWDscp *-supervisor.sh mini3:$PWDscp *-supervisor.sh mini4:$PWD# 2 配置环境变量 #vim /etc/profileSTORM_HOME=/root/apps/storm-1.1.1PATH=$PATH:$STORM_HOME/binexport STORM_PATH PATHsource /etc/profile# 3 启动集群中所有节点supervisor进程,并在主节点上启动nimbus和ui进程start-storm.sh# 4 停止集群中所有节点supervisor进程,并停止nimbus和ui进程stop-storm.sh# 开机自动运行下之前的start-all脚本,设置方法如下vi /etc/rc.d/rc.local # 添加执行脚本#!/bin/sh## This script will be executed *after* all the other init scripts.# You can put your own initialization stuff in here if you don‘t# want to do the full Sys V style init stuff.touch /var/lock/subsys/localsh /root/apps/storm-1.1.1/bin/start-storm.sh标签:ati 添加 this mon his grep while 集群 文件
原文地址:http://www.cnblogs.com/edgedance/p/8007598.html