Databases Reference
In-Depth Information
LocalCluster cluster = new LocalCluster ();
cluster . submitTopology ( "Getting-Started-Toplogie" , conf ,
builder . createTopology ());
Thread . sleep ( 1000 );
cluster . shutdown ();
}
}
See It In Action
You're ready to run your first topology! If you create a file at src/main/resources/
words.txt with one word per line, you can run the topology with this command:
mvn exec:java -Dexec.mainClass="TopologyMain" -Dexec.args="src/main/resources/
words.txt"
For example, if you use the following words.txt file:
Storm
test
are
great
is
an
Storm
simple
application
but
very
powerful
really
Storm
is
great
In the logs, you should see something like the following:
is: 2
application: 1
but: 1
great: 1
test: 1
simple: 1
Storm: 3
really: 1
are: 1
great: 1
an: 1
powerful: 1
very: 1
In this example, you're only using a single instance of each node. But what if you have
a very large log file? You can easily change the number of nodes in the system to par-
allelize the work. In this case, you'll create two instances of WordCounter :
 
Search WWH ::




Custom Search