2015-10-16 182 views
1

我想在使用Eclipse的遠程主機上提交Storm拓撲。無法提交風暴拓撲

這裏是我的代碼:

Config conf = new Config(); 
conf.setDebug(false); 
conf.setNumWorkers(1); 
conf.put(Config.NIMBUS_HOST, "hostName"); 
conf.put(Config.NIMBUS_THRIFT_PORT,6627); 
conf.put(Config.STORM_ZOOKEEPER_SERVERS,Arrays.asList(new String[]{"hostName"})); 
conf.put(Config.STORM_ZOOKEEPER_PORT,2181); 

// Remote submission 
StormSubmitter.submitTopology("classMain", conf, topology); 

但我得到這個異常:

Exception in thread "main" java.lang.RuntimeException: org.apache.thrift7.TApplicationException: Binary field exceeded string size limit 
    at backtype.storm.StormSubmitter.submitTopologyAs(StormSubmitter.java:250) 
at backtype.storm.StormSubmitter.submitTopology(StormSubmitter.java:271) 
    at backtype.storm.StormSubmitter.submitTopology(StormSubmitter.java:157) 
    at com.rbc.rbccm.hackathon.Countersearch.submitTopology(Countersearch.java:111) 
    at com.rbc.rbccm.hackathon.Countersearch.main(Countersearch.java:37) 
Caused by: org.apache.thrift7.TApplicationException: Binary field exceeded string size limit 
    at org.apache.thrift7.TApplicationException.read(TApplicationException.java:111) 
    at org.apache.thrift7.TServiceClient.receiveBase(TServiceClient.java:71) 
    at backtype.storm.generated.Nimbus$Client.recv_submitTopology(Nimbus.java:184) 
    at backtype.storm.generated.Nimbus$Client.submitTopology(Nimbus.java:168) 
    at backtype.storm.StormSubmitter.submitTopologyAs(StormSubmitter.java:236) 
... 4 more 

是存在於我們可以傳遞給submitTopology函數的參數字符串大小限制?

當我跟隨線索多一點,它會導致:

public void submitTopology(String name, String uploadedJarLocation, String jsonConf, StormTopology topology) throws AlreadyAliveException, InvalidTopologyException, AuthorizationException, org.apache.thrift.TException 
{ 
    send_submitTopology(name, uploadedJarLocation, jsonConf, topology); 
    recv_submitTopology(); 
} 

recv導致問題。有什麼想法嗎?

+1

jar文件的絕對路徑名有多長? –

+0

「C:\\ adasd \\ sdsd \\ workspace \\ adasdasdsadsad \\ target \\ sample-mainClass-0.0.1.jar」 是否太長? – AbtPst

+0

當您嘗試使用命令行客戶端將您的jar上傳到Storm拓撲時會發生什麼? – morganw09dev

回答

1

您需要增加nimbus.thrift.max_buffer_size參數。您可以將其設置爲storm.yamlConfig對象。

+0

謝謝!那工作。 – AbtPst

+0

感謝Matthias,但是由於max_buffer_size現在已被棄用(https://storm.apache.org/releases/1.0.0/javadocs/org/apache/storm/Config.html#NIMBUS_THRIFT_MAX_BUFFER_SIZE),現在該如何解決問題?我遇到了同樣的錯誤。 – Nav

+0

問題是你的非常大的jar文件。 Storm 1.0引入了一個分佈式緩存https://storm.apache.org/releases/1.0.0/distcache-blobstore.html我從來沒有嘗試過,但你應該能夠在那裏上傳你的jar文件(而不是通過Nimbus傳輸它。 –

0

如果你看到在風暴的源代碼的代碼在StormSubmitter.java,那就是:

public static void submitTopology(String name, Map stormConf, StormTopology topology) 
     throws AlreadyAliveException, InvalidTopologyException, AuthorizationException { 
    submitTopology(name, stormConf, topology, null, null); 
} 

節儉錯誤是因爲無論是name指定太長(大於2MB的?)或stormConf有太多的的信息或有更可能的原因,這就是當topology創建時,您填充Spout或Bolt實例太多的信息。

在我的情況下,我創建了一個螺栓,我正在初始化太多的數據。

builder.setBolt(genBolt, new GenBolt(myTable1.getHashMap(), myTable2.getHashMap(), myTable3.getHashMap(), myTable4.getHashMap()), 2) 
    .fieldsGrouping(iterSpout, new Fields(con.BATCH_ID))