The Storm client will enable you to use the commands to manage topologies into a cluster. To install the Storm client, follow these steps:
Download the latest stable version from the Storm site (https://github.com/nathanmarz/storm/downloads) at this moment the latest version is storm-0.6.2.
Once you’ve downloaded the version, unzip it into the /usr/local/bin/storm to have storm in a shared directory.
Next, add the storm binary PATH
variable to be able to run the storm
command without having to put the complete path, if we’ve used the
/usr/local/bin/storm directory, the command will be
export PATH=$PATH:/usr/local/bin/storm.
After that, you need to create a Storm local configuration where you’ll say which is your nimbus host. To do it, create a file in ~/.storm/storm.yaml with the following content:
nimbus.host: "our nimbus address"
Now, you have the needed to manage topologies in your Storm cluster.
The Storm client contains all the storm commands needed to run a Storm cluster, but to run it you need to install other tools and configure some params. See how to do that into the Appendix B.
To manage the topologies into the cluster, you have a bunch of very simple and useful commands that allow you to submit, kill, disable, re-enable, and rebalance our topology.
The jar
command is responsible for
executing your topology and submitting it to the cluster through the
StormSubmitter
object into the main
class.
storm jar path-to-topology-jar class-with-the-main arg1 arg2 argN
path-to-topology-jar is the complete path to the compiled jar where your topology code and all your libraries are. The class-with-the-main will be the main place where the StormSubmitter is executed and the rest of arguments will be the params that receive our main method.
With Storm you have the capability to suspend or disable a running topology, deactivating the topology spouts, so when we deactivate the topology, all emitted tuples will be processed, but the nextTuple method of the topology spouts will not be called.
To disable a topology, run:
storm deactivate topology-name
If you want re-activate a disabled topology, run:
storm activate topology-name
If you want to destroy a topology, you can use the
kill
command. This will destroy the topology in a secure
fashion, disabling the topology first and waiting for the duration of the
topology’s message, allowing the topology to finish the process of the
current streams.
To kill a topology, run:
storm kill topology-name
You can change the waiting time after the topology is deactivated
using the -w [time-in-sec]
parameter when you run the
Storm kill command.
Rebalance enables you to redistribute the tasks through all worker tasks into a cluster. This is a powerful command when you have not balanced your tasks. For example, when you add nodes to a running cluster. The rebalance command will deactivate the topology for the duration of message timeout and redistribute the workers so Storm will re-activate the topology.
To rebalance a topology, run:
storm rebalance topology-name
If you want to use another deactivation duration, you could use the
-w
parameter to set it:
storm rebalance topology-name -w other-time
You can see the complete list of Storm commands by running the Storm client without parameters. The complete description of these commands can be found at https://github.com/nathanmarz/storm/wiki/Command-line-client.