storm启动命令

1.启动nimbus,进程名为nimbus

在nimbus虚拟机上去输入 : nohup storm nimbus &

2.启动supervisor,进程名为supervisor

在supervisor虚拟机上去输入 : nohup storm supervisor &

3.启动ui,进程名为core

在集群所有虚拟机上输入 : nohup storm ui &

4.启动log

在集群所有虚拟机上输入 : nohup storm log &

5.上传topo

storm jar storm_topo.jar com.cjun.MainTopology myTopo

storm_topo.jar:项目的jar包

com.cjun.MainTopology:主类的路径

myTopo:此topo在storm ui中显示的名称

6.杀死storm进程

先用jps查看storm进程,然后用:kill -9 x,杀死对应的进程,x为对应进程的进程号。

 

提交Topologies

命令格式:storm jar 【jar路径】 【拓扑包名.拓扑类名】 【拓扑名称】

样例:storm jar /storm-starter.jar storm.starter.WordCountTopology wordcountTop

#提交storm-starter.jar到远程集群,并启动wordcountTop拓扑。

停止Topologies

命令格式:storm kill 【拓扑名称】

样例:storm kill wordcountTop

#杀掉wordcountTop拓扑。

启动nimbus后台程序

命令格式:storm nimbus

启动supervisor后台程序

命令格式:storm supervisor

启动drpc服务

命令格式:storm drpc

启动ui服务

命令格式:storm ui

启动REPL

REPL — read-evaluate-print-loop。

虽然clojure可以作为一种脚本语言内嵌在java里面,但是它的首选编程方式是使用REPL,这是一个简单的命令行接口,使用它你可以输入你的命令,执行,然后查看结果, 你可以以下面这个命令来启动REPL:

命令格式:storm repl

打印本地配置

命令格式:storm localconfvalue 【配置参数关键字】

举例:storm localconfvalue storm.zookeeper.servers

#根据指定参数打印本地配置的值。

打印远程配置

命令格式:storm remoteconfvalue 【配置参数关键字】

举例:storm remoteconfvalue storm.zookeeper.servers

#根据指定参数打印远程配置的值。

执行Shell脚本

命令格式:storm shell resourcesdir command args

打印CLASSPATH

命令格式:storm classpath

 

一、设置节点间无密码访问
为了实现批量启动和停止,需要提前配置好各节点间的无密码访问,具体方法详见我以前的帖子或者问度娘,这里不再介绍。
二、(主节点)切换当前路径到storm的bin目录下,并创建以下脚本和文件。

cd /software/storm/apache-storm-0.9.2-incubating/bin
touch start-supervisor.sh
touch start-all.sh
touch stop-supervisor.sh
touch stop-all.sh
touch supervisor-hosts

赋予以上脚本可执行权限

chmod +x *.sh

三、脚本编写
1、start-supervisor.sh

#!/bin/bash
. /etc/profile

# storm的bin目录
bin=/software/storm/apache-storm-0.9.2-incubating/bin
supervisors=$bin/supervisor-hosts

storm nimbus >/dev/null 2>&1 &
storm ui >/dev/null 2>&1 &

 cat $supervisors | while read supervisor
 do
        echo $supervisor
        ssh $supervisor $bin/start-supervisor.sh &
 done

2、start-supervisor.sh

#!/bin/bash
. /etc/profile

storm supervisor >/dev/null 2>&1 &

3、stop-all.sh

#!/bin/bash
. /etc/profile

# storm的bin目录
bin=/software/storm/apache-storm-0.9.2-incubating/bin
supervisors=$bin/supervisor-hosts

kill -9 `ps -ef|grep daemon.nimbus| awk '{print $2}'`
kill -9 `ps -ef|grep ui.core| awk '{print $2}'`

 cat $supervisors | while read supervisor
 do
        echo $supervisor
        ssh $supervisor $bin/stop-supervisor.sh &
 done

4、stop-supervisor.sh

#!/bin/bash
. /etc/profile

kill -9 `ps -ef|grep daemon.supervisor| awk '{print $2}'`

# 这里我直接清理了storm的工作路径和log文件,根据自身需要来设置
rm -rf /software/storm/workdir/*
rm -rf /software/storm/apache-storm-0.9.2-incubating/logs/*

5、supervisor-hosts
文件中写入所有节点的主机名或者ip,格式如下:

storm1
storm2
storm3

四、脚本的使用

脚本需要在主节点上使用。为了便于使用,请确保环境变量中已经加入storm的bin目录。

将上文编辑好的start-supervisor和stop-supervisor脚本复制到所有节点相同路径下。

scp *-supervisor.sh storm2:/software/storm/apache-storm-0.9.2-incubating/bin
scp *-supervisor.sh storm3:/software/storm/apache-storm-0.9.2-incubating/bin
  • 启动集群中所有节点supervisor进程,并在主节点上启动nimbus和ui进程
start-all.sh
  • 停止集群中所有节点supervisor进程,并停止nimbus和ui进程
stop-all.sh

五、设置开机自启
要实现storm开机自启,比较简单的方法就是开机自动运行下之前的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/local

sh /software/storm/apache-storm-0.9.2-incubating/bin/start-all.sh

 

转载于:https://my.oschina.net/u/2300159/blog/371209

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值