本文共 1914 字,大约阅读时间需要 6 分钟。
[root@s166 fantj]# mkdir input[root@s166 fantj]# cd input/[root@s166 input]# echo "hello fantj" > file1.txt[root@s166 input]# echo "hello hadoop" > file2.txt[root@s166 input]# echo "hello mapreduce" > file3.txt[root@s166 input]# lsfile1.txt file2.txt file3.txt
[root@s166 input]# hadoop fs -mkdir /wordcount[root@s166 input]# hadoop fs -ls /Found 1 itemsdrwxr-xr-x - root supergroup 0 2018-07-27 07:51 /wordcount[root@s166 input]# cd ..[root@s166 fantj]# lsdownload hadoop input jdk[root@s166 fantj]# hadoop fs -put input/* /wordcount[root@s166 fantj]# hadoop fs -ls /wordcountFound 3 items-rw-r--r-- 3 root supergroup 12 2018-07-27 07:52 /wordcount/file1.txt-rw-r--r-- 3 root supergroup 13 2018-07-27 07:52 /wordcount/file2.txt-rw-r--r-- 3 root supergroup 16 2018-07-27 07:52 /wordcount/file3.txt
[root@s166 fantj]# cd /home/fantj/hadoop/share/hadoop/[root@s166 hadoop]# lscommon hdfs httpfs kms mapreduce tools yarn[root@s166 hadoop]# cd mapreduce/[root@s166 mapreduce]# lshadoop-mapreduce-client-app-2.7.0.jar hadoop-mapreduce-client-hs-plugins-2.7.0.jar hadoop-mapreduce-examples-2.7.0.jarhadoop-mapreduce-client-common-2.7.0.jar hadoop-mapreduce-client-jobclient-2.7.0.jar libhadoop-mapreduce-client-core-2.7.0.jar hadoop-mapreduce-client-jobclient-2.7.0-tests.jar lib-exampleshadoop-mapreduce-client-hs-2.7.0.jar hadoop-mapreduce-client-shuffle-2.7.0.jar sources[root@s166 mapreduce]# hadoop jar hadoop-mapreduce-examples-2.7.0.jar wordcount /wordcount /print
[root@s166 mapreduce]# hadoop fs -ls /printFound 2 items-rw-r--r-- 3 root supergroup 0 2018-07-27 07:55 /print/_SUCCESS-rw-r--r-- 3 root supergroup 37 2018-07-27 07:55 /print/part-r-00000[root@s166 mapreduce]# hadoop fs -cat /print/part-r-00000fantj 1hadoop 1hello 3mapreduce 1
转载地址:http://eolhx.baihongyu.com/