Storm集群启动与停止脚本及其注意事项

前提:集群之间首先要做免密码登陆
集群中主节点启动:nimbus和ui进程
从节点启动:supervisor和logviewer进程

1:启动集群
需要先设置从节点的ip,保存到文件supervisorhost中,一行是一个节点的ip
192.168.1.171
192.168.1.172

在主节点写一个脚本:start-all.sh
#!/bin/bash
    source /etc/profile
    echo "start nimus and ui on localhost ..."
    nohup /usr/local/storm/bin/storm nimbus >/dev/null 2>&1 &
    nohup /usr/local/storm/bin/storm ui >/dev/null 2>&1 &
    cat supervisorhost | while read ip
    do
    echo "start supervisor and logviewer on $ip"
    ssh $ip nohup /usr/local/storm/bin/storm supervisor >/dev/null 2>&1 &
    ssh $ip nohup /usr/local/storm/bin/storm logviewer >/dev/null 2>&1 &
    done

2:停止集群
首先写一个停止从节点supervisor和logviewer进程的脚本stop-supervisor.sh,并且需要把这个脚本拷贝到storm集群的所有从节点

#!/bin/bash
    source /etc/profile
    kill -9 `ps -ef|grep backtype.storm.daemon.supervisor | awk '{print $2}'|head -1` &
    kill -9 `ps -ef|grep backtype.storm.daemon.logviewer | awk '{print $2}'|head -1` &
在主节点上写一个脚本:stop-all.sh
#!/bin/bash
    source /etc/profile
    echo "stop nimus and ui on localhost ..."
    kill -9 `ps -ef|grep backtype.storm.daemon.nimbus | awk '{print $2}'|head -1` >/dev/null 2>&1
    kill -9 `ps -ef|grep backtype.storm.ui.core | awk '{print $2}'|head -1` >/dev/null 2>&1
    cat supervisorhost | while read ip
    do
    echo "stop supervisor and logviewer on $ip"
    ssh $ip /bin/bash /usr/local/storm/bin/stop-supervisor.sh >/dev/null 2>&1 &
    done

3:使用
在主节点上执行start-all.sh即可启动集群所有服务
在主节点上执行stop-all.sh即可停止集群所有服务

4:注意
笔者将apache-storm-0.9.3 改名为storm
所有脚本都放到storm的bin目录下面
集群内的所有storm包都存放在相同路径下
集群中zookeeper节点的时间要保持一致。(ntpdate time.nist.gov)

  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值