An example Java application that will programmatically submit an Apache Storm topology to a Storm cluster. Based on the example from http://nishutayaltech.blogspot.in/2014/06/submitting-topology-to-remote-storm.html.
##Build and package
-
Install Maven and Java
-
From the command line, change directories to this project root and use the following to build and package:
mvn package
This will create a file named SubmitToNimbus-0.0.1-SNAPSHOT.jar in the target directory.
##Use it
-
Get a Storm topology. For example, you can build a basic word count topology following steps at https://github.com/Blackmist/hdinsight-java-storm-wordcount.
-
Make sure you know the Nimbus server host node for your Hadoop/Storm cluster and that you can reach it from the machine you are on. For example,
ping hostname
and see if the name resolves.If you can't remotely connect to the host, you'll need to copy both the SubmitToNimbus-0.0.1-SNAPSHOT.jar and the Storm topology (as a .jar file,) to a node on the Hadoop/Storm cluster.
-
Use the following to submit the topology using this application:
java -jar SubmitToNimbus-0.0.1-SNAPSHOT.jar <storm-topology-jar-file> <friendly-name-for-topology> <nimbus-host>
- <storm-topology-jar-file> should be the path to the jar file that contains the topology you want to submit.
- <friendly-name-for-topology> is a name you make up. Just something so you remember what this topology is.
- <nimbus-host> is either the host name, fully qualified domain name (FQDN) or IP address of the cluster node that Nimbus is running on.
If all goes well, you will see a message saying "Topology successfully submitted."
If you want to verify that the topology was submitted and is running, you can use the Storm UI for your cluster, or the storm
command from a command line on the cluster. For example, storm list
will show the topologies, and the one you submitted should be listed (with the friendly name you provided.)