storm使用
1. 下载
https://github.com/nathanmarz/storm/downloads
2. 配置
解压,修改配置
nimbus配置
解压后修改conf/storm.yaml文件,
storm.zookeeper.servers:
- "ip1"
- "ip2"
./storm nimbus 启动storm主节点服务
./storm ui 启动storm监控页面:监控地址:http://ip:8080
---------------------------------------------------
supervisor配置
修改storm.yaml 文件:
storm.zookeeper.servers:
-"ip1"
-"ip2"
nimbus.host: "ip3"
#这个是storm将要启动几个本地work,一个端口对应一个work。
supervisor.slots.ports: - 6700 - 6701 - 6702 - 67032,启动supervisor
./storm supervisor
3. 使用
提交任务
./storm/bin/storm jar Getting-Started-0.0.1-SNAPSHOT.jar TopologyMain "src/main/resources/words.txt"
4. 异常处理
在提交topology的时候有时可能出现如下异常:
Exception in thread "main" java.lang.IllegalArgumentException: Nimbus host is not set
at backtype.storm.utils.NimbusClient.<init>(NimbusClient.java:30)
at backtype.storm.utils.NimbusClient.getConfiguredClient(NimbusClient.java:17)
at backtype.storm.StormSubmitter.submitJar(StormSubmitter.java:78)
at backtype.storm.StormSubmitter.submitJar(StormSubmitter.java:71)
at backtype.storm.StormSubmitter.submitTopology(StormSubmitter.java:50)
at com.taobao.kaleidoscope.storm.IcdbTopology.main(IcdbTopology.java:59)
但是启动nimbus是没有问题的, 这个主要以为内conf_dir路径设置不正确, 在bin/storm脚本中需要加上这样一句:
CONF_DIR = STORM_DIR + "/conf"