How to submit a topology in storm production cluster using IDE

abhi picture abhi · Apr 3, 2013 · Viewed 14.8k times · Source

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 production cluster using IDE, while the same thing if i perform in command line using storm jar command, its running like heaven. I have seen examples of the same from githublink.

For submitting topology i am using these set of lines

conf.put(Config.NIMBUS_HOST, NIMBUS_NODE);
conf.put(Config.NIMBUS_THRIFT_PORT,6627);
conf.put(Config.STORM_ZOOKEEPER_PORT,2181);
conf.put(Config.STORM_ZOOKEEPER_SERVERS,ZOOKEEPER_ID);
conf.setNumWorkers(20);
conf.setMaxSpoutPending(5000);
StormSubmitter submitter = new StormSubmitter();
submitter.submitTopology("test", conf, builder.createTopology());

Please suggest me if this is the correct approach to run?

Answer

abhi picture abhi · Apr 5, 2013

Well found the solution. When we ran "storm jar" it trigger a property flag for storm.jar in the submitted jar. So if we want to programmatically submit a jar then simply set the flag this way

System.setProperty("storm.jar", <path-to-jar>);

For example:

System.setProperty("storm.jar", "/Users/programming/apache-storm-1.0.1/lib/storm-core-1.0.1.jar");
StormSubmitter.submitTopology("myTopology", config, builder.createTopology());