0 准备文件 test 内容如下,中间用 \t间隔
[root@hadoop3 ~]# cat test hello you hello me
1 找到如下路径
hadoop2.5.2/share/hadoop/mapreduce: 位置下找到 example.jar
2 执行如下命令:
[root@hadoop3 mapreduce]# hadoop jar hadoop-mapreduce-examples-2.5.2.jar wordcount /input/test /output
其中,如果不知道能运行的主函数名称 可以使用:
hadoop jar hadoop-mapreduce-examples.jar 然后回车
此时会提示 可供调用的主函数名词, eg:
[root@hadoop3 mapreduce]# hadoop jar hadoop-mapreduce-examples-2.5.2.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. bbp: A map/reduce program that uses Bailey-Borwein-Plouffe to compute exact digits of Pi. dbcount: An example job that count the pageview counts from a database. distbbp: A map/reduce program that uses a BBP-type formula to compute exact bits of Pi. 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 a quasi-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. 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. wordmean: A map/reduce program that counts the average length of the words in the input files. wordmedian: A map/reduce program that counts the median length of the words in the input files. wordstandarddeviation: A map/reduce program that counts the standard deviation of the length of the words in the input files.
运行结果如下:
hello 2 me 1 you 1
相关推荐
Hadoop中单词统计案例运行的代码
适合Hadoop初学者安装Hadoop
在前面《MapReduce实例分析:单词计数》教程中已经介绍了用 MapReduce 实现单词计数的基本思路和具体执行过程。下面将介绍如何编写具体实现代码及如何运行程序。 首先,在本地创建 3 个文件:file00l、file002 和 ...
该压缩包是在官方包的基础上进行修改的,将Windows运行hadoop所需配置文件和部分插件已经导入,电脑只需安装64位java环境,修改hadoop-env.cmd配置即可使用
有时候在eclipse上运行项目,需要引用的Hadoop的jar包,也就是hadoop的外部依赖包,有conf,fs,io,mapreduce等等,这里列举了一部分,基本上hadoop的所有外部依赖jar包都包含在内了,如果下载了不会使用,可以看我...
wordcount单词统计,hadoop程序,可直接放在hadoop环境中运行
大数据实验报告Hadoop编程实现wordcount单词统计程序附源码.doc
包含配置hadoop过程中遇到的一些问题的解决办法和成功运行wordcount实例的步骤
window下eclipse中运行mapreduce程序所需要的Hadoop全部jar包
Hadoop3.0 + JDK1.8.1+Hadoop-win运行包2.6.0--3.0.0
eclipse连接hadoop所需要的hadoop.ddl和eclipse插件和hadoop运行案例
完整的Hadoop jar包,解压直接用。
Hadoop运行原理分析pdf
Hadoop工具包 Hadoop工具包 Hadoop工具包 Hadoop工具包 Hadoop工具包
Hadoop- 单词计数(Word Count)的MapReduce实现.doc
Hadoop运行流程详解 Hadoop运行流程详解 Hadoop运行流程详解 Hadoop运行流程详解 Hadoop运行流程详解
使用ecplice操作hadoop所需要的各种jar包。包括hdfs,maprudce,yarn,httpfs,kms。
hadoop 3.3.2源码包
一个hadoop的简单介绍,可以让刚刚入门的同学们对hadoop有一个大概的了解。