如何在Eclipse中调试Apache Storm? [英] How to debug Apache Storm in Eclipse?

查看:219
本文介绍了如何在Eclipse中调试Apache Storm?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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



如果是简单的jar,那我们可以调试。但是,这里我们使用以下命令部署jar:
storm jar project.jar main_class_name



不知道我们如何可以部署风暴拓扑,所以我们可以在调试模式下做风暴项目?



请找到更新的yaml文件如下:

  

#在一个
#或更多的贡献者许可协议下授权给Apache Software Foundation(ASF)。请参阅与此工作一起发布的NOTICE文件
#以了解有关版权所有权的其他信息
#。 ASF根据Apache许可证版本2.0(
#许可证)向您授予该文件
#;您不得使用此文件,除非符合
#与许可证。您可以在

#http://www.apache.org/licenses/LICENSE-2.0

#获得许可证副本,除非适用法律或以书面形式同意,根据许可证分发的软件
#以按现状分发,B $ b#,不附带任何明示或暗示的保证或条件。
#请参阅许可证,以获得有关权限的特定语言以及许可证下的
#限制。

###########这些必须填写风暴配置
#storm.zookeeper.servers:
# - server1
# - server2

#nimbus.host:nimbus


######这些可以选择填写:

##自定义序列号列表
#topology.kryo.register:
# - org.mycompany.MyType
# - org.mycompany.MyType2: org.mycompany.MyType2Serializer

##自定义kryo装饰器列表
#topology.kryo.decorators:
# - org.mycompany.MyDecorator

## drpc服务器的位置
#drpc.servers:
# - server1
# - server2

##指标消费者
#topology.metrics.consumer.register:
# - class:backtype.storm.metric.LoggingMetricsConsumer
#parallelism.hint:1
# - class:org.mycompany .MyMetricsConsumer
#parallelism.hint:1
#参数:
# - 端点:metrics-collector.mycompany.org

worker.childopts: - agentlib:jdwp = transport = dt_socket,server = y,address = 8999,suspend = n


解决方案

如果要远程调试,则需要在工作JVM中启用调试。请参阅这里获取正确的Java标志:远程调试Java应用程序



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



在Eclipse中,选择运行 - >调试配置并创建一个新的远程Java应用程序。指定要调试的正在运行的工作JVM的主机和端口(端口必须与 worker.childopts 中指定的相同)。


We can generate storm jar using particular parameter. However, if we need to debug this project (actually a far) locally as well as remotely?

If it is simple jar, that we can debug. However, here we are deploying jar using following command: storm jar project.jar main_class_name

Not sure how can we deploy storm topology, so that we can do storm project in debugging mode?

Please find updated yaml file as below:

 

    # 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"

解决方案

If you want to remote debug, you need to enable debugging in worker JVMs. See here for the correct Java flags: Remote debugging a Java application

Add this flags in all/shared supervisor storm.yaml to entry worker.childopts (it might be necessary to restart Storm cluster). You need to make sure, that only a single worker is stared per host! Otherwise, two JVMs want to open the same port and one will fail of course.

In Eclipse, choose Run -> Debug Configuration and create a new Remote Java Application. Specify the host and port (port must be the same as specified in worker.childopts) of the running worker JVM you want to debug.

这篇关于如何在Eclipse中调试Apache Storm?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆