{"title": "hadoop\u6837\u4f8b\u7a0b\u5e8f", "update_time": "2013-04-09 10:08:18", "tags": "example hadoop", "pid": "235", "icon": "hadoop.png"}
Hadoop集群搭建好以后,我们可以用hadoop example测试一下集群是否已经可以正常工作了。 hadoop example程序在hadoop发行版本根目录下,如hadoop-examples-0.20.2-cdh3u4.jar 执行hadoop jar hadoop-examples-0.20.2-cdh3u4.jar可以看到所有样例程序: ``` An example program must be given as the first argument. Valid program names are: aggregatewordcount: An Aggregate based map/reduce program that counts the words in the input files. aggregatewordhist: An Aggregate based map/reduce program that computes the histogram of the words in the input files. dbcount: An example job that count the pageview counts from a database. grep: A map/reduce program that counts the matches of a regex in the input. join: A job that effects a join over sorted, equally partitioned datasets multifilewc: A job that counts words from several files. pentomino: A map/reduce tile laying program to find solutions to pentomino problems. pi: A map/reduce program that estimates Pi using monte-carlo method. randomtextwriter: A map/reduce program that writes 10GB of random textual data per node. randomwriter: A map/reduce program that writes 10GB of random data per node. secondarysort: An example defining a secondary sort to the reduce. sleep: A job that sleeps at each map and reduce task. sort: A map/reduce program that sorts the data written by the random writer. sudoku: A sudoku solver. teragen: Generate data for the terasort terasort: Run the terasort teravalidate: Checking results of terasort wordcount: A map/reduce program that counts the words in the input files. ``` A.用hadoop来算个PI ``` hadoop jar hadoop-examples-0.20.2-cdh3u4.jar pi 100 100 ```