2016-03-10 134 views
0

我從後下噴口和螺栓信息時,風暴罐子使用靈氣客戶端部署在風暴UI失蹤

How to submit a topology in storm production cluster using IDE

Below is my implementation 

TopologyBuilder builder = new TopologyBuilder(); 

     Map storm_conf = Utils.readStormConfig(); 
     storm_conf.put("nimbus.host", "localhost"); 
     Nimbus.Client client = NimbusClient.getConfiguredClient(storm_conf) 
       .getClient(); 
     String inputJar = "/home/user/TestType-1.0.jar"; 
     NimbusClient nimbus = null; 
     try { 
      nimbus = new NimbusClient(storm_conf, "localhost", 6627); 
     } catch (TTransportException e) { 
      System.out.println("unable to connect to client"); 
      e.printStackTrace(); 
     } 

     System.setProperty("storm.jar", "/home/user/TestType-1.0.jar"); 

     String jsonConf = JSONValue.toJSONString(storm_conf); 
     try { 
      nimbus.getClient().submitTopology("SellerPageTypeTopology", 
        "/home/user/TestType-1.0.jar", jsonConf, builder.createTopology()); 
     } catch (AlreadyAliveException e) { 
      e.printStackTrace(); 
     } catch (InvalidTopologyException e) { 
      e.printStackTrace(); 
     } catch (Exception e) { 
      e.printStackTrace(); 
     } 

我是能夠成功地部署拓撲跟着一個例子。在暴風雨中,我能夠看到拓撲活動,但噴嘴和螺栓細節丟失。任何想法是什麼我想念失蹤。謝謝您的幫助。

回答

0

您已經創建了一個空的拓撲,然後提交了它。你的嘴和螺栓沒有顯示出來,因爲你還沒有加入他們還沒有到您TopologyBuilder:

Config config = new Config(); 
TopologyBuilder builder = new TopologyBuilder(); 
builder.setSpout(MY_SPOUT_ID, mySpout); 
builder.setBolt(MY_BOLT1_ID, myBolt1, 2).shuffleGrouping(MY_SPOUT_ID); 
builder.setBolt(MY_BOLT2_ID, myBolt2).shuffleGrouping(MY_SPOUT_ID); 

參考:https://docs.hortonworks.com/HDPDocuments/HDP2/HDP-2.3.2/bk_storm-user-guide/content/storm-parallelism.html

+0

我宣佈嘴和螺栓裝在罐子我。可能我錯過了一種在NimbusClient API中指定主類的方法。 – user3514641