Databases Reference
In-Depth Information
None Grouping
At the time of this writing (Storm version 0.7.1), using this grouping is the same as
using “Shuffle Grouping” on page 22 . In other words, when using this grouping, it
doesn't matter how streams are grouped.
LocalCluster versus StormSubmitter
Until now, you have used a utility called LocalCluster to run the topology on your local
computer. Running the Storm infrastructure on your computer lets you run and debug
different topologies easily. But what about when you want to submit your topology to
a running Storm cluster? One of the interesting features of Storm is that it's easy to send
your topology to run in a real cluster. You'll need to change the LocalCluster to a
StormSubmitter and implement the submitTopology method, which is responsible for
sending the topology to the cluster.
You can see the changes in the code below:
//LocalCluster cluster = new LocalCluster();
//cluster.submitTopology("Count-Word-Topology-With-Refresh-Cache", conf,
builder . createTopology ());
StormSubmitter . submitTopology ( "Count-Word-Topology-With-Refresh-Cache" , conf ,
builder . createTopology ());
//Thread.sleep(1000);
//cluster.shutdown();
When you use a StormSubmitter , you can't control the cluster from your
code as you could with a LocalCluster .
Next, package the source into a jar, which is sent when you run the Storm Client com-
mand to submit the topology. Because you used Maven, the only thing you need to do
is go to the source folder and run the following:
mvn package
Once you have the generated jar, use the storm jar command to submit the topology
(you should know how to install the Storm client into Appendix A ). The syntax is storm
jar allmycode.jar org.me.MyTopology arg1 arg2 arg3 .
In this example, from the topologies source project folder, run:
storm jar target/Topologies-0.0.1-SNAPSHOT.jar countword.TopologyMain src/main/
resources/words.txt
With these commands, you have submitted the topology to the cluster.
To stop/kill it, run:
storm kill Count-Word-Topology-With-Refresh-Cache
 
Search WWH ::




Custom Search