【问题标题】:How to debug Apache Storm in Local Cluster/Mode through eclipse如何通过 eclipse 在本地集群/模式下调试 Apache Storm
【发布时间】:2015-12-01 00:43:21
【问题描述】:

使用以下问答,我设法在 Apache Storm 集群(本地运行)上通过 eclipse 启用调试。 How to debug Apache Storm in Eclipse?

我的conf/storm.yaml 有以下行可以在工作节点上启用调试:

worker.childopts: "-agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=y"

当我将拓扑提交到storm 以运行(在集群中)时,我可以设置断点并在我的编辑器中查看变量。

但是当我尝试在本地运行它时(在Local Mode),我似乎无法连接(连接被拒绝) - 通过 eclipse。

# I'm using storm crawler, I submit a topology like so:
storm jar target/storm-crawler-core-10.6-SNAPSHOT-jar-with-dependencies.jar \
 com.digitalpebble.storm.crawler.CrawlTopology \
-conf crawler-conf.yaml \
-local

# ^ The `-local` runs it in a `LocalCluster`
# If I submit it to my actual cluster (without -local), I can debug it through eclipse.

# View the pastebin for all the output : http://pastebin.com/PEdA7fH0

I have included all the output from the above command to a pastebin. Click here to view it

More information on how storm crawler launches the LocalCluster.

我希望能够在本地模式下进行调试,这样我就可以在命令行中看到输出(当我通过我设置的断点时)并快速进行更改并重新运行,基本上是为了加快我的开发速度流。


在 LocalCluster (Local Mode) 中运行 Apache Storm 时,如何通过 eclipse 调试器调试我的代码?

【问题讨论】:

    标签: java eclipse debugging apache-storm


    【解决方案1】:

    如果您在本地模式下运行,则不涉及任何工作JVM,即没有工作进程被启动。因此,您的worker.childopts 设置没有任何效果。

    在 Eclipse 中调试它的最简单方法是在 Eclipse 中而不是命令行中提交/启动拓扑。您的类CrawlTopology 有一个main 方法,因此您可以直接在Eclipse 中执行它(当然是在调试模式下)。您不需要指定 jar 文件名。只需在 Eclipse 运行配置中指定选项 -conf crawler-conf.yaml -local。

    【讨论】:

      【解决方案2】:

      在本地模式下,您可以使用例如

      export STORM_JAR_JVM_OPTS="-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=localhost:8000"
      

      在调用storm jar命令使用Eclipse进行远程调试之前。

      【讨论】:

        【解决方案3】:

        我们可以像在 Eclipse 中调试任何其他 java 代码一样调试 Storm Topology。我使用 LocalCluster 模式在 Eclipse 本身中启动我的拓扑。我可以调试 ShellBolts、Trident 螺栓等。

        此外,我还在我的 Eclipse 中添加了storm-core作为项目(而不是 maven 依赖项),这使我能够调试和了解storm内部发生的事情。有助于更好地跟踪元组确认、发出处理程序、锚点、超时、异常等。

        【讨论】:

        • 如何调试销钉?我尝试在我的 javascript bolt 上设置断点,但它引发了异常。
        猜你喜欢
        • 1970-01-01
        • 2015-11-20
        • 2020-12-27
        • 1970-01-01
        • 2023-03-19
        • 2021-06-02
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多