storm
相关文档
storm 用来完成:任务的并发提交,路由,调度,和执行。
storm 编程中使用的核心 API
backtype.storm.topology.IComponent
拓扑结构中所有 component 的核心接口
backtype.storm.spout.ISpout
spouts 的接口
backtype.storm.task.IBolt
bolt 的接口
backtype.storm.task.TopologyContext
拓扑上下文信息
backtype.storm.spout.SpoutOutputCollector
This output collector exposes the API for emitting tuples from an backtype.storm.topology.IRichSpout. The main difference between this output collector and OutputCollector for backtype.storm.topology.IRichBolt is that spouts can tag messages with ids so that they can be acked or failed later on. This is the Spout portion of Storm’s API to guarantee that each message is fully processed at least once.
backtype.storm.task.OutputCollector
This output collector exposes the API for emitting tuples from an IRichBolt. This is the core API for emitting tuples. For a simpler API, and a more restricted form of stream processing, see IBasicBolt and BasicOutputCollector.
storm 并发机制
配置 executor 和 task
配置示例代码如下:
1 | builder.setBolt(COUNT_BOLT_ID, countBolt, 2).setNumTasks(4) |
其中 setBolt 调用的第3个参数,就是设置并发数,也就是executor(线程)数。
setNumTasks 设置 bolt 个数
相关参考文档:
Parallelism of a Storm Topology
启动 storm 集群
启动 zookeeper
启动 nimbus
启动 supervisor
启动 ui
提交 topology
1 | storm jar storm-book-0.0.1-SNAPSHOT.jar {strom-topology-name} {stormname} |
- kill topology
1 | storm kill {stormname} |
storm 日志配置
配置文件在 ${STORM_HOME}/logback/cluster.xml
日志文件默认路径
${STORM_HOME}/logs
storm componet的生命周期
参考:
Twitter Storm源代码分析之Topology的执行过程