一个storm程序的执行流程 [英] Execution flow of a storm program

查看:51
本文介绍了一个storm程序的执行流程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 Storm 的新手,试图了解从 spoutbolt 的不同方法的执行流程.就像 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...

  1. 创建喷口和螺栓
  2. declareOutputFields
  3. 喷口/螺栓序列化并分配给工人

其次,在集群上某处的每个工作线程中...

Second, in each worker somewhere on the cluster...

  1. Spouts open 和 Bolts prepare(发生一次)
  2. 在一个循环中...
    • Spouts 调用 ackfailnextTuple
    • 螺栓调用execute
  1. Spouts open and Bolts prepare (happens once)
  2. In a loop...
    • Spouts call ack, fail, and nextTuple
    • Bolts call execute

<小时>

如果您的拓扑已停用...


If your topology is deactivated...

  • 您的 spouts deactivate 方法将被调用.当您再次激活拓扑时,将调用 activate.
  • Your spouts deactivate method will be called. When you activate the topology again then activate 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆