如何在Eclipse中调试Apache Storm?

Jag*_*adi 8 debugging remote-debugging apache-storm

我们可以使用特定参数生成风暴罐.但是,如果我们需要在本地以及远程调试此项目(实际上是远程)?

如果它是简单的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"

Run Code Online (Sandbox Code Playgroud)

Mat*_*Sax 10

如果要进行远程调试,则需要在工作JVM中启用调试.请参阅此处以获取正确的Java标志:远程调试Java应用程序

将所有/共享主管中的此标志添加storm.yaml到条目中worker.childopts(可能需要重新启动Storm群集).你需要确保每个主机只盯着一个工人!否则,两个JVM想要打开同一个端口,一个当然会失败.

在Eclipse中,选择Run -> Debug Configuration并创建一个新的Remote Java Application.指定worker.childopts要调试的正在运行的工作JVM 的主机和端口(端口必须与指定的端口相同).


Jas*_* K. 5

要在各个管理引擎VM之间启用调试,您只需编辑storm.yaml文件并将worker.childopts条目更新为:

worker.childopts:" - agentlib:jdwp = transport = dt_socket,server = y,suspend = n,address = 5%ID%"

如果您的主管在6700,6701,6702等端口上,这将在56700,56701,56702等处创建一个调试端口.