我们可以使用特定参数生成风暴jar。但是,如果我们需要在本地和远程调试这个项目(实际上很远)?
如果它是简单的jar,我们可以调试。但是,这里我们使用以下命令部署jar: storm jar project.jar main_class_name
不确定我们如何部署风暴拓扑,以便我们可以在调试模式下执行风暴项目?
请查找更新的yaml文件,如下所示:
# 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"
答案 0 :(得分:9)
如果要进行远程调试,则需要在工作JVM中启用调试。请参阅此处以获取正确的Java标志:Remote debugging a Java application
将所有/共享主管storm.yaml
中的此标志添加到条目worker.childopts
(可能需要重新启动Storm群集)。 您需要确保每个主机只有一个工作人员盯着它!否则,两个JVM想要打开同一个端口,当然会有一个失败。
在Eclipse中,选择Run -> Debug Configuration
并创建一个新的Remote Java Application
。指定要调试的正在运行的工作JVM的主机和端口(端口必须与worker.childopts
中指定的端口相同)。
答案 1 :(得分:5)
要在各个管理员VM之间启用调试,您只需编辑storm.yaml文件并将workers.childopts条目更新为:
worker.childopts:" -agentlib:jdwp = transport = dt_socket,server = y,suspend = n,address = 5%ID%"
如果您的主管在6700,6701,6702等端口,这将在56700,56701,56702等上创建一个调试端口。