编程语言
首页 > 编程语言> > java-如何通过eclipse在本地群集/模式下调试Apache Storm

java-如何通过eclipse在本地群集/模式下调试Apache Storm

作者:互联网

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

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

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

当我提交要运行的拓扑以在群集中运行时,可以在编辑器中设置断点并查看变量.

但是,当我尝试在本地运行它时(在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调试器调试代码?

解决方法:

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

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

标签:java,debugging,eclipse,apache-storm
来源: https://codeday.me/bug/20191009/1877999.html