[hadoop@tiandong63 ~]$ /home/hadoop/hadoop-2.7.7/bin/hadoop fs -ls /test/
drwxr-xr-x - hadoop supergroup 0 2018-12-30 21:40 /test/input
上传文件:
创建一个计算的文件:
[hadoop@tiandong63 ~]$ more file1.txt
welcome to beijing
my name is thunder
what is your name
上传到HDFS的/test/input文件夹中
[hadoop@tiandong63 ~]$ /home/hadoop/hadoop-2.7.7/bin/hadoop fs -put /home/hadoop/file1.txt /test/input
查看是否上传成功:
[hadoop@tiandong63 ~]$ /home/hadoop/hadoop-2.7.7/bin/hadoop fs -ls /test/input
Found 1 items
-rw-r--r-- 2 hadoop supergroup 56 2018-12-30 21:40 /test/input/file1.txt
计算:
[hadoop@tiandong63 ~]$ /home/hadoop/hadoop-2.7.7/bin/hadoop jar /home/hadoop/hadoop-2.7.7/share/hadoop/mapreduce/hadoop-mapreduce-examples-2.7.7.jar wordcount /test/input /test/output
查看运行结果:
[hadoop@tiandong63 ~]$ /home/hadoop/hadoop-2.7.7/bin/hadoop fs -cat /test/output/part-r-00000
beijing 1
is 2
my 1
name 2
thunder 1
to 1
welcome 1
what 1
your 1