如何在eclipse中调试apachestorm?

5vf7fwbs  于 2021-06-21  发布在  Storm
关注(0)|答案(2)|浏览(460)

我们可以使用特定的参数生成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 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"
inkz8wg9

inkz8wg91#

要在不同的supervisor VM之间启用调试,您只需编辑storm.yaml文件并将worker.childopts条目更新为以下内容:
worker.childopts:“-agentlib:jdwp=transport=dt_socket,服务器=y,挂起=n,地址=5%id%“
如果在端口670067016702等上有监管者,这将在567005670156702等上创建一个调试端口。

bnl4lu3b

bnl4lu3b2#

如果要进行远程调试,则需要在工作JVM中启用调试。有关正确的java标志,请参见此处:远程调试java应用程序
在所有/共享管理器中添加此标志 storm.yaml 进入 worker.childopts (可能需要重新启动风暴群)。您需要确保,每个主机只有一个worker!否则,两个jvm想要打开同一个端口,其中一个当然会失败。
在eclipse中,选择 Run -> Debug Configuration 创建一个新的 Remote Java Application . 指定主机和端口(端口必须与中指定的相同) worker.childopts )要调试的正在运行的worker jvm的。

相关问题