一个storm程序的执行流程 [英] Execution flow of a storm program
问题描述
我是 Storm 的新手,试图了解从 spout
到 bolt
的不同方法的执行流程.就像 spout 有不同的方法,比如
I am new in storm and trying to understand the flow of execution of different methods from spout
to bolt
.
Like spout has different methods like
nextTuple()
nextTuple()
打开()
declareOutputFields()
declareOutputFields()
激活()
停用()
和 bolt 有类似
and bolt has methods like
准备()
执行()
清理()
declareOutputFields()
declareOutputFields()
那么谁能告诉我这些方法的执行顺序?
so can anyone tell me the sequence of execution of these methods ?
推荐答案
首先,当您的拓扑启动时...
First, when your topology is started...
- 创建喷口和螺栓
declareOutputFields
- 喷口/螺栓序列化并分配给工人
其次,在集群上某处的每个工作线程中...
Second, in each worker somewhere on the cluster...
- Spouts
open
和 Boltsprepare
(发生一次) - 在一个循环中...
- Spouts 调用
ack
、fail
和nextTuple
- 螺栓调用
execute
- Spouts 调用
- Spouts
open
and Boltsprepare
(happens once) - In a loop...
- Spouts call
ack
,fail
, andnextTuple
- Bolts call
execute
- Spouts call
<小时>
如果您的拓扑已停用...
If your topology is deactivated...
- 您的 spouts
deactivate
方法将被调用.当您再次激活拓扑时,将调用activate
.
- Your spouts
deactivate
method will be called. When you activate the topology again thenactivate
will be called.
如果您的拓扑被终止...
If your topology is killed...
- Spouts 可能有
close
调用 - 螺栓可能调用了
cleanup
- Spouts might have
close
called - Bolts might have
cleanup
called
注意:
不保证 close 会被调用,因为主管 kill -9 在集群上的工作进程.来源
There is no guarentee that close will be called, because the supervisor kill -9's worker processes on the cluster. source
这篇关于一个storm程序的执行流程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!