使用以下问答,我设法在 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"
当我将 Topology 提交给 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 中运行 Apache Storm 时如何通过 eclipse 调试器调试我的代码 (Local Mode) ?
最佳答案
如果您以本地模式运行,则不涉及工作 JVM,即没有启动工作进程。因此,您的 worker.childopts
设置没有任何效果。
在 Eclipse 中调试的最简单方法是在 Eclipse 中提交/启动拓扑而不是命令行。您的类 CrawlTopology
有一个 main
方法,因此您可以直接在 Eclipse 中执行它(当然是在 Debug模式下)。您不需要指定 jar 文件名。只需在 Eclipse 运行配置中指定选项 -conf crawler-conf.yaml -local
。
关于java - 如何通过 eclipse 在本地集群/模式下调试 Apache Storm,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32405136/