风暴工人分配的建筑历史

Building history of storm worker assignments

我想建立一个像

这样的中心化历史
timestamp : topology_name : component_name : topology_id : component_id : VM hostname : VM IP : Worker port

在 Storm 中最好的做法是什么?我能想到

  1. 从 spout/bolt
  2. 的 prepare() 方法报告此问题
  3. 编写报告分配的自定义调度程序

Reporting this from prepare() method of a spout/bolt

这要求您强制执行某种类型的 spout 和 bolt,并且您需要考虑不调用 super.prepare 的子类,例如通过制作 prepare final 并使其调用 protected abstract prepare0 以在那里执行子类逻辑。

Write a custom scheduler that reports the assignments

这就是我要做的,因为它对于 spout 和 bolt 注册更加透明,并且可以在没有任何限制和不兼容的情况下重复使用。它可能更复杂,需要更深入地了解 Storm 内部结构。