In this section, we will focus on how we can deploy topologies on a remote Storm cluster. We will start with the installation of a Storm client on the client machine, which can be different from the machines in the Storm cluster because submitting and deploying topologies on a remote Storm cluster requires a Storm client.
The following are the steps that need to be performed to set up a Storm client:
STORM_HOME
environment variable to make the installation easier.$STORM_HOME/conf
directory at the client node and add the following line to the storm.yaml
file:nimbus.host: "nimbus.host.ip"
storm.yaml
file located at $STORM_HOME/conf
in the ~/.storm
folder on the client machine.Once the installation of the Storm client is done, we are good to go to deploy a topology on the remote machine. To demonstrate how we can deploy a topology on the remote cluster, we will use the sample
topology developed in Chapter 1, Setting Up Storm on a Single Machine. The following are the commands that need to be executed to deploy a topology on the remote cluster.
Go to the $STORM_HOME
directory on the client machine and run the following command:
bin/storm jar jarName.jar [TopologyMainClass] [Args]
This section will explain how we can deploy the sample topology created in Chapter 1, Setting Up Storm on a Single Machine, on the Storm cluster by performing the following steps:
bin/storm jar $STORM_PROJECT_HOME/target/storm-example-0.0.1-SNAPSHOT-jar-with-dependencies.jar com.learningstorm.storm_example.LearningStormSingleNodeTopology LearningStormClusterTopology
The output of the preceding command is as follows:
18 [main] INFO backtype.storm.StormSubmitter - Uploading topology jar ../storm-example/target/storm-example-0.0.1-SNAPSHOT-jar-with-dependencies.jar to assigned location: /tmp/storm-data/nimbus/inbox/stormjar-aa96e582-1676-4654-a995-15a4e88b6a50.jar 28 [main] INFO backtype.storm.StormSubmitter - Successfully uploaded topology jar to assigned location: /tmp/storm-data/nimbus/inbox/stormjar-aa96e582-1676-4654-a995-15a4e88b6a50.jar 29 [main] INFO backtype.storm.StormSubmitter - Submitting topology test-ack in distributed mode with conf {"topology.workers":3} 196 [main] INFO backtype.storm.StormSubmitter - Finished submitting topology: LearningStormClusterTopology
The preceding console output shows that the LearningStormClusterTopology
topology is submitted on the remote cluster, and three worker processes are executed.
jps
commands on the supervisor machines to view the worker process:jps
command on the first supervisor machine:jps
The preceding command's output is as follows:
24347 worker 23940 supervisor 24593 Jps 24349 worker
Two worker processes are assigned to the first supervisor machine.
jps
command on the second supervisor machine:jps
The preceding command's output is as follows:
24344 worker 23941 supervisor 24543 Jps
One worker process is assigned to the second supervisor machine.
3.145.173.199