我们可以使用特定的参数生成风暴jar。然而,如果我们需要在本地和远程调试这个项目(实际上是远)?
如果是简单的jar,那我们可以调试。但是,这里我们使用以下命令部署jar:storm jar project.jar main_class_name
不确定我们如何部署storm拓扑,以便我们可以在调试模式下做storm项目?
请找到更新的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"
如果您想要远程调试,您需要在worker jvm中启用调试。查看正确的Java标志:远程调试Java应用程序
将所有/共享管理器storm.yaml
中的此标志添加到worker.childopts
条目(可能需要重新启动Storm集群)。你需要确保,每台主机只启动一个worker !否则,两个jvm都想打开相同的端口,其中一个当然会失败。
在Eclipse中,选择Run -> Debug Configuration
并创建新的Remote Java Application
。指定要调试的正在运行的worker JVM的主机和端口(端口必须与worker.childopts
中指定的端口相同)。
要启用跨各种主管vm的调试,您所要做的就是编辑storm。并更新worker。child的条目类似:
工人。childopts:"-agentlib: jdwp =运输= dt_socket, server = y,暂停= n,地址= 5% id %"
如果您在端口6700,6701,6702等上有您的主管,这将在56700,56701,56702等上创建一个调试端口。