How to submit a topology in storm production cluster using IDE

后端 未结 4 809
臣服心动
臣服心动 2020-12-25 15:02

I am facing an issue Must submit topologies using the \'storm\' client script so that StormSubmitter knows which jar to upload while submitting a topology to a

4条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-25 15:26

    For submitting a topology to remote Storm cluster, you need to upload that jar to nimbus machine and then submit that jar to Cluster using NimbusClient.
    You can do it like this:

    Map storm_conf = Utils.readStormConfig();
    storm_conf.put("nimbus.host", "");
    Client client = NimbusClient.getConfiguredClient(storm_conf)
                                    .getClient();
    String inputJar = "C:\\workspace\\TestStormRunner\\target\\TestStormRunner-0.0.1-SNAPSHOT-jar-with-dependencies.jar";
    NimbusClient nimbus = new NimbusClient(storm_conf, "",
                                    );
     // upload topology jar to Cluster using StormSubmitter
    String uploadedJarLocation = StormSubmitter.submitJar(storm_conf,
                                    inputJar);
    
    String jsonConf = JSONValue.toJSONString(storm_conf);
    nimbus.getClient().submitTopology("testtopology",
                          , jsonConf, builder.createTopology());
    

    Here is the working example : Submitting a topology to Remote Storm Cluster

提交回复
热议问题