Question

I am trying my hands on Hadoop 1.0. I am getting Target does not exists while copying one file from local system into HDFS.

My hadoop command and its output is as follows :

shekhar@ubuntu:/host/Shekhar/Softwares/hadoop-1.0.0/bin$ hadoop dfs -put /host/Users/Shekhar/Desktop/Downloads/201112/20111201.txt .
Warning: $HADOOP_HOME is deprecated.

put: Target  already exists

After observing the output, we can see that there are two blank spaces between word 'Target' and 'already'. I think there has to be something like /user/${user} between those 2 words. If I give destination path explicitly as /user/shekhar then I get following error :

shekhar@ubuntu:/host/Shekhar/Softwares/hadoop-1.0.0/bin$ hadoop dfs -put /host/Users/Shekhar/Desktop/Downloads/201112/20111201.txt /user/shekhar/data.txt
Warning: $HADOOP_HOME is deprecated.

put: java.io.FileNotFoundException: Parent path is not a directory: /user/shekhar

Output of ls command is as follows :

shekhar@ubuntu:/host/Shekhar/Softwares/hadoop-1.0.0/bin$ hadoop dfs -lsr /
Warning: $HADOOP_HOME is deprecated.

drwxr-xr-x   - shekhar supergroup          0 2012-02-21 19:56 /tmp
drwxr-xr-x   - shekhar supergroup          0 2012-02-21 19:56 /tmp/hadoop-shekhar
drwxr-xr-x   - shekhar supergroup          0 2012-02-21 19:56 /tmp/hadoop-shekhar/mapred
drwx------   - shekhar supergroup          0 2012-02-21 19:56 /tmp/hadoop-shekhar/mapred/system
-rw-------   1 shekhar supergroup          4 2012-02-21 19:56 /tmp/hadoop-shekhar/mapred/system/jobtracker.info
drwxr-xr-x   - shekhar supergroup          0 2012-02-21 19:56 /user
-rw-r--r--   1 shekhar supergroup    6541526 2012-02-21 19:56 /user/shekhar

Please help me in copying file into HDFS. If you need any other information then please let me know.

I am trying this in Ubuntu which is installed using WUBI (Windows Installer for ubuntu).

Thanks in Advance !

Was it helpful?

Solution

-rw-r--r-- 1 shekhar supergroup 6541526 2012-02-21 19:56 /user/shekhar

shekhar@ubuntu:/host/Shekhar/Softwares/hadoop-1.0.0/bin$ hadoop dfs -put /host/Users/Shekhar/Desktop/Downloads/201112/20111201.txt /user/shekhar/data.txt

OTHER TIPS

The problem in the put command is the trailing .. You need to specify the full path on HDFS where you want the file to go, for ex:

hadoop fs -put /host/Users/Shekhar/Desktop/Downloads/201112/20111201.txt /whatever/20111201.txt

If the directory that you are putting the file in doesn't exist yet, you need to create it first:

hadoop fs -mkdir /whatever

The problem that you are having when you specify the path explicitly is that on your system, /user/shekar is a file, not a directory. You can see that because it has a non-0 size.

you must make the file first!

hdfs dfs -mkdir /user/hadoop hdfs dfs -put /home/bigdata/.password /user/hadoop/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top