I have installed hadoop-1.0.3 in my system(14.04), followed this tutorial.
And I successfully run an sample mapreduce program for wordcount as follows,
hadoopuser@arul-PC:/usr/local/hadoop$ bin/hadoop jar hadoop*examples*.jar wordcount /user/hadoopuser/SampleData /user/hadoopuser/SampleOutput
14/06/17 15:25:45 INFO input.FileInputFormat: Total input paths to process : 3
14/06/17 15:25:45 INFO util.NativeCodeLoader: Loaded the native-hadoop library
14/06/17 15:25:45 WARN snappy.LoadSnappy: Snappy native library not loaded
14/06/17 15:25:45 INFO mapred.JobClient: Running job: job_201406171444_0002
14/06/17 15:25:46 INFO mapred.JobClient: map 0% reduce 0%
14/06/17 15:26:04 INFO mapred.JobClient: map 66% reduce 0%
14/06/17 15:26:13 INFO mapred.JobClient: map 100% reduce 0%
14/06/17 15:26:16 INFO mapred.JobClient: map 100% reduce 22%
14/06/17 15:26:28 INFO mapred.JobClient: map 100% reduce 100%
14/06/17 15:26:33 INFO mapred.JobClient: Job complete: job_201406171444_0002
14/06/17 15:26:33 INFO mapred.JobClient: Counters: 29
14/06/17 15:26:33 INFO mapred.JobClient: Job Counters
14/06/17 15:26:33 INFO mapred.JobClient: Launched reduce tasks=1
14/06/17 15:26:33 INFO mapred.JobClient: SLOTS_MILLIS_MAPS=33037
14/06/17 15:26:33 INFO mapred.JobClient: Total time spent by all reduces waiting after reserving slots (ms)=0
14/06/17 15:26:33 INFO mapred.JobClient: Total time spent by all maps waiting after reserving slots (ms)=0
14/06/17 15:26:33 INFO mapred.JobClient: Launched map tasks=3
14/06/17 15:26:33 INFO mapred.JobClient: Data-local map tasks=3
14/06/17 15:26:33 INFO mapred.JobClient: SLOTS_MILLIS_REDUCES=21208
14/06/17 15:26:33 INFO mapred.JobClient: File Output Format Counters
14/06/17 15:26:33 INFO mapred.JobClient: Bytes Written=880838
14/06/17 15:26:33 INFO mapred.JobClient: FileSystemCounters
14/06/17 15:26:33 INFO mapred.JobClient: FILE_BYTES_READ=2214875
14/06/17 15:26:33 INFO mapred.JobClient: HDFS_BYTES_READ=3671899
14/06/17 15:26:33 INFO mapred.JobClient: FILE_BYTES_WRITTEN=3775759
14/06/17 15:26:33 INFO mapred.JobClient: HDFS_BYTES_WRITTEN=880838
14/06/17 15:26:33 INFO mapred.JobClient: File Input Format Counters
14/06/17 15:26:33 INFO mapred.JobClient: Bytes Read=3671523
14/06/17 15:26:33 INFO mapred.JobClient: Map-Reduce Framework
14/06/17 15:26:33 INFO mapred.JobClient: Map output materialized bytes=1474367
14/06/17 15:26:33 INFO mapred.JobClient: Map input records=77931
14/06/17 15:26:33 INFO mapred.JobClient: Reduce shuffle bytes=1207341
14/06/17 15:26:33 INFO mapred.JobClient: Spilled Records=255966
14/06/17 15:26:33 INFO mapred.JobClient: Map output bytes=6076101
14/06/17 15:26:33 INFO mapred.JobClient: Total committed heap usage (bytes)=517210112
14/06/17 15:26:33 INFO mapred.JobClient: CPU time spent (ms)=11530
14/06/17 15:26:33 INFO mapred.JobClient: Combine input records=629172
14/06/17 15:26:33 INFO mapred.JobClient: SPLIT_RAW_BYTES=376
14/06/17 15:26:33 INFO mapred.JobClient: Reduce input records=102324
14/06/17 15:26:33 INFO mapred.JobClient: Reduce input groups=82335
14/06/17 15:26:33 INFO mapred.JobClient: Combine output records=102324
14/06/17 15:26:33 INFO mapred.JobClient: Physical memory (bytes) snapshot=589725696
14/06/17 15:26:33 INFO mapred.JobClient: Reduce output records=82335
14/06/17 15:26:33 INFO mapred.JobClient: Virtual memory (bytes) snapshot=1862012928
14/06/17 15:26:33 INFO mapred.JobClient: Map output records=629172When I check the output file it is present in output folder,
hadoopuser@arul-PC:/usr/local/hadoop$ bin/hadoop dfs -ls /user/hadoopuser/SampleOutput
Found 3 items
-rw-r--r-- 1 hadoopuser supergroup 0 2014-06-17 15:26 /user/hadoopuser/SampleOutput/_SUCCESS
drwxr-xr-x - hadoopuser supergroup 0 2014-06-17 15:25 /user/hadoopuser/SampleOutput/_logs-rw-r--r-- 1 hadoopuser supergroup 880838 2014-06-17 15:26 /user/hadoopuser/SampleOutput/part-r-00000
I tried to open it using following command,
hadoopuser@avvenire-PC:/usr/local/hadoop$ bin/hadoop dfs -cat /user/hadoopuser/SampleOutput/part-r-0000But I am getting result as follows,
cat: File does not exist: /user/hadoopuser/SampleOutput/part-r-0000Please provide me a solution. Thank in advance.
02 Answers
Check the file name. Its five 0's not four.
0bin/hadoop dfs -cat /user/hadoopuser/SampleOutput/part-r-00000
So I realize that an answer has already been accepted, but here's the solution when it happened to me (just incase anyone else sees this thread).
TLDR; make sure there aren't any conflicting folder names in your hadoop directory (for me it was /usr/local/hadoop).
When I was generating output, I was putting it in a folder called output/, however prior to this program I had another that was also writing to output, and I had saved the output data in a folder specifically called output in my hadoop directory. This was causing problems for me, since even though that folder didn't show up when I ran bin/hadoop fs -ls, the command bin/hadoop fs -cat output/* was actually searching in the folder that I had generated before, instead of the output of the program that I had just run. After deleting that output directory with rm -rf output/, the problem went away.