我们这里用自带的示例程序来运行wordcount,从而来演示Hadoop的功能。
/home/cndba/hadoop/share/hadoop/mapreduce/hadoop-mapreduce-examples-3.1.1.jar
导入测试文件:
[http://www.cndba.cn@hadoopmaster hadoop]$ ls
bin dfs etc include lib libexec LICENSE.txt logs NOTICE.txt README.txt sbin share tmp var
[http://www.cndba.cn@hadoopmaster hadoop]$ hdfs dfs -put LICENSE.txt /dave
[http://www.cndba.cn@hadoopmaster hadoop]$
[http://www.cndba.cn@hadoopmaster hadoop]$ hdfs dfs -ls /
Found 3 items
drwxr-xr-x - cndba supergroup 0 2019-01-23 23:16 /dave
drwxr-xr-x - cndba supergroup 0 2019-01-23 21:33 /oracle
drwxr-xr-x - cndba supergroup 0 2019-01-23 22:36 /system
[http://www.cndba.cn@hadoopmaster hadoop]$ hdfs dfs -ls -R /
drwxr-xr-x - cndba supergroup 0 2019-01-23 23:16 /dave
-rw-r--r-- 2 cndba supergroup 147144 2019-01-23 23:16 /dave/LICENSE.txt
-rw-r--r-- 2 cndba supergroup 0 2019-01-23 21:51 /dave/www.cndba.cn.txt
drwxr-xr-x - cndba supergroup 0 2019-01-23 21:33 /oracle
drwxr-xr-x - cndba supergroup 0 2019-01-23 21:33 /oracle/mysql
drwxr-xr-x - cndba supergroup 0 2019-01-23 22:36 /system
示例的jar包在如下目录:https://www.cndba.cn/dave/article/3260
https://www.cndba.cn/dave/article/3260
[http://www.cndba.cn@hadoopmaster mapreduce]$ pwd
/home/cndba/hadoop/share/hadoop/mapreduce
执行Hadoop MR程序:https://www.cndba.cn/dave/article/3260
https://www.cndba.cn/dave/article/3260
[http://www.cndba.cn@hadoopmaster mapreduce]$ hadoop jar hadoop-mapreduce-examples-3.1.1.jar wordcount /dave/LICENSE.txt output
2019-01-23 23:55:14,527 INFO client.RMProxy: Connecting to ResourceManager at hadoopmaster/192.168.20.80:8032
2019-01-23 23:55:14,944 INFO mapreduce.JobResourceUploader: Disabling Erasure Coding for path: /tmp/hadoop-yarn/staging/cndba/.staging/job_1548242934753_0003
2019-01-23 23:55:15,344 INFO input.FileInputFormat: Total input files to process : 1
2019-01-23 23:55:15,461 INFO mapreduce.JobSubmitter: number of splits:1
2019-01-23 23:55:15,538 INFO Configuration.deprecation: yarn.resourcemanager.system-metrics-publisher.enabled is