在安装storm之前先要安装好JDK和zookeeper
准备
机器准备:
10.242.167.193 (nimbus)
10.242.167.194 (nimbus)
10.242.167.195 (supervisor)
10.242.167.196 (supervisor)
10.242.167.197 (supervisor)
10.242.167.198 (zk)
10.242.167.199 (zk)
10.242.167.200 (zk)
去storm官网下载apache-storm-1.1.3.tar.gz
安装
先配置机器间的互信/etc/hosts
tar -xivf apache-storm-1.1.3.tar.gz -C /opt
mv apache-storm-1.1.1 storm
配置主节点:
########### These MUST be filled in for a storm configuration
storm.zookeeper.servers:
- "dbmspreapp221"
- "dbmspreapp222"
- "dbmspreapp223"
storm.zookeeper.port: 2181
nimbus.seeds: ["dbmspreapp230", "dbmspreapp229"]
storm.local.dir: "/bak/storm"
supervisor.slots.ports:
- 6700
- 6701
- 6702
- 6703
worker.childopts: "-Xmx4096m"
配置完后把整个文件scp到各个节点
然后启动集群:
分别在机器上启动:
cd /opt/storm/bin
10.242.167.193 (nimbus):./storm nimbus & ./storm ui &
10.242.167.194 (nimbus): ./storm nimbus &
10.242.167.195 (supervisor):./storm supervisor &
10.242.167.196 (supervisor):./storm supervisor &
10.242.167.197 (supervisor):./storm supervisor &
然后访问:http://10.242.167.193:8080
命令行提交任务:
把写好的代码打包成jar:然后执行
storm jar ./storm-example-0.0.1-SNAPSHOT.jar com.blogchong.storm.helloworld.WordCountTopology task
1. jar:运行你的storm job,topology是类中的主函数
2../storm-example-0.0.1-SNAPSHOT.jar:提交的jar包
3.com.blogchong.storm.helloworld.WordCountTopology:执行的主类
4.task:Topology任务名称,注意这个是不能重复的
基本搭建完成