Reputation: 633
I have configured Storm on my machine. Zookeeper, Nimbus and Supervisor are running properly. Now I want to submit a topology to this storm. I am trying to use storm jar. but I am not able to submit it. Can anybody please give an example for this. It will be very helpful. Thanks in advance:)
Upvotes: 7
Views: 13845
Reputation: 20658
Unfortunately, almost all the examples on the internet show the word counter example, and do not mention the steps required in a simple way:
All you need to do is this:
1. Navigate to your storm bin folder:
cd /Users/nav/programming/apache-storm-1.0.1/bin
2. Start nimbus
./storm nimbus
3. Start supervisor
./storm supervisor
4. Start the ui program
./storm ui
5. Make sure you build your jar file with the storm jar excluded from it.
6. Make sure your /Users/nav/programming/apache-storm-1.0.1/conf/storm.yaml
file is valid (this should've been step 2).
7. Make sure that in your code, you are submitting the topology using StormSubmitter.submitTopology
8. Navigate to the storm bin folder again
cd /Users/nav/programming/apache-storm-1.0.1/bin
9. Submit your jar file to storm
./storm jar /Users/nav/myworkspace/StormTrial/build/libs/StormTrial.jar com.abc.stormtrial.StormTrial
The above command is basically just this:
stormExecutable jarOption pathToYourJarFile theClassContainingYourMainFile
If you want to pass commandline arguments to your program, add it at the end:
stormExecutable jarOption pathToYourJarFile theClassContainingYourMainFile commandlineArguments
Here, com.abc.stormtrial
is the full package name and .StormTrial
is the name of the class that contains your main
function.
Now open up your browser and type http://127.0.0.1:8080
and you'll see your topology running via Storm's UI.
Upvotes: 5
Reputation: 6510
The answer is in the official documentation, and it is clear enough. Run storm jar path/to/allmycode.jar org.me.MyTopology arg1 arg2 arg3
(replace with your project name and arguments if any). Make sure you are using StormSubmitter object instead of LocalCluster.
Upvotes: 8