Debugging 如何在Eclipse中调试Apache Storm?
我们可以使用特定的参数生成storm jar。然而,如果我们需要在本地和远程调试这个项目(实际上是一个far) 如果是简单的jar,我们可以调试。但是,这里我们使用以下命令部署jar: storm jar project.jar main\u class\u name 不确定如何部署storm拓扑,以便在调试模式下执行storm项目 请查找更新的yaml文件,如下所示:Debugging 如何在Eclipse中调试Apache Storm?,debugging,remote-debugging,apache-storm,Debugging,Remote Debugging,Apache Storm,我们可以使用特定的参数生成storm jar。然而,如果我们需要在本地和远程调试这个项目(实际上是一个far) 如果是简单的jar,我们可以调试。但是,这里我们使用以下命令部署jar: storm jar project.jar main\u class\u name 不确定如何部署storm拓扑,以便在调试模式下执行storm项目 请查找更新的yaml文件,如下所示: # Licensed to the Apache Software Foundation (ASF) under
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
########### These MUST be filled in for a storm configuration
# storm.zookeeper.servers:
# - "server1"
# - "server2"
#
# nimbus.host: "nimbus"
#
#
# ##### These may optionally be filled in:
#
## List of custom serializations
# topology.kryo.register:
# - org.mycompany.MyType
# - org.mycompany.MyType2: org.mycompany.MyType2Serializer
#
## List of custom kryo decorators
# topology.kryo.decorators:
# - org.mycompany.MyDecorator
#
## Locations of the drpc servers
# drpc.servers:
# - "server1"
# - "server2"
## Metrics Consumers
# topology.metrics.consumer.register:
# - class: "backtype.storm.metric.LoggingMetricsConsumer"
# parallelism.hint: 1
# - class: "org.mycompany.MyMetricsConsumer"
# parallelism.hint: 1
# argument:
# - endpoint: "metrics-collector.mycompany.org"
worker.childopts:"-agentlib:jdwp=transport=dt_socket,server=y,address=8999,suspend=n"
如果要进行远程调试,则需要在辅助JVM中启用调试。有关正确的Java标志,请参见此处: 在all/shared supervisor
storm.yaml
中将此标志添加到条目worker.childopts
(可能需要重新启动storm群集)您需要确保每个主机只有一个工作进程否则,两个JVM想要打开同一个端口,其中一个当然会失败
在Eclipse中,选择
Run->Debug Configuration
并创建一个新的远程Java应用程序
。指定要调试的正在运行的辅助JVM的主机和端口(端口必须与在worker.childopts
中指定的相同)。要启用跨多个监控虚拟机的调试,只需编辑storm.yaml文件并将worker.childopts条目更新为以下内容:
worker.childopts:“-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5%ID%”
如果您的监管者在端口670067016702等上,这将在567005670156702等上创建调试端口。谢谢。让我试试这个。我正在安装默认的storm.yaml文件。为了向其中添加所需参数,我添加了以下参数:worker.childopts:“java-agentlib:jdwp=transport=dt_socket,server=y,address=8999,suspend=n-jar application.jar”这将导致以下错误:>线程“main”中的异常ja va.lang.ExceptionInInitializeError由以下原因引起:java.lang.ClassCastException:java.lang.String无法在backtype.storm.utils.utils.utils.FindReadConfigFile(utils.java:141)处强制转换为java.util.Map在backtype.storm.utils.utils.readStormConfig(utils.java:188)中的backtype.storm.utils.utils.(utils.java:71)。。。还有57个找不到主类:backtype.storm.daemon.nimbus。程序将退出。我想我还需要应用任何其他设置。现在…是的。我可以通过eclipse复制它。这似乎有两个问题:1。nimbus、supervisor、ui运行不正常,一个接一个的开火命令。我在执行中延迟了15秒。2.当Topology部署之后,若我并没有立即开始调试,那个么连接拒绝错误就来了。我能解决它。非常感谢Matthias在这方面的帮助。谢谢!!!!请记住,如果您不幸使用了Ambari,这将不起作用,因为Ambari不尊重yaml文件中使用的格式。。。是默认端口。您是否知道如何以及何时将%ID%转换为主管的端口?离开它太久了,抱歉。