user2653926
user2653926

Reputation: 604

hadoop fs operations file not found

I installed and configured hadoop recently on my ubuntu 12.04 operated machine. The installation was successful and I am able to start all services successfully. I am facing problem with hadoop fs . I think I have set it up correctly since hadoop fs is not giving any error like command not found. I am facing error while doing any operation with hadoop fs like ls, put, copyFromLocal.

Every operation ends up in showing No such file or directory error though being provided with valid path. Please help me solve this.

Output by hdfs

recmach@chetan-HP-ENVY-15-Notebook-PC:~/hadoop/hadoop-2.6.1/sbin$ hadoop fs -ls /home/recmach
ls: `/home/recmach': No such file or directory

Output by ls for same directory

recmach@chetan-HP-ENVY-15-Notebook-PC:~/hadoop/hadoop-2.6.1/sbin$ ls -l /home/recmach
total 52
drwxr-xr-x 2 recmach hadoop 4096 Oct 21 13:57 Desktop
drwxr-xr-x 2 recmach hadoop 4096 Oct 21 13:57 Documents
drwxr-xr-x 2 recmach hadoop 4096 Oct 21 15:27 Downloads
-rw-r--r-- 1 recmach hadoop 8445 Oct 21 11:56 examples.desktop
drwxrwxr-x 3 recmach hadoop 4096 Oct 21 13:10 hadoop
drwxr-xr-x 2 recmach hadoop 4096 Oct 21 13:57 Music
drwxr-xr-x 2 recmach hadoop 4096 Oct 21 13:57 Pictures
drwxr-xr-x 3 recmach hadoop 4096 Oct 21 15:58 Public
drwxr-xr-x 2 recmach hadoop 4096 Oct 21 13:57 Templates
drwxr-xr-x 4 recmach hadoop 4096 Oct 21 14:50 tmp
drwxr-xr-x 2 recmach hadoop 4096 Oct 21 13:57 Videos

Upvotes: 0

Views: 1522

Answers (2)

shanmuga
shanmuga

Reputation: 4499

No output for hadoop fs -ls / shows that your hdfs is empty.
The reason you are getting FileNotFound is because you are trying absolute path from your local filesystem.

Try creating a drirectory iun HDFS and list directory.

hadoop fs -mkdir /abcd
hadoop fs -ls /

You should get an output like

drwxr-xr-x - user supergroup 0 2015-10-21 17:33 /abcd

You should understand that HDFS is different from your local file system.

Now you want to copy a file from your local file system to HDFS, for this use haddop fs -put <file on local filesystem> <destination path on HDFS>.

date > current_time.txt #creates a new file
hadoop fs -put current_time.txt /abcd/
hadoop fs -ls /abcd

Should give you the output like

-rw-r--r-- 3 user supergroup 26 2015-10-21 17:35 /abcd/current_time.txt

Upvotes: 1

Vinkal
Vinkal

Reputation: 2984

when we execute hadoop fs -ls ., Hadoop, by default, looks for /user/<current login user>

Since you are facing error No such file or directory, it seems that /user/<current login user> doesn't exist in hdfs.

To fix this issue, execute following command

hadoop fs -mkdir -p /user/<current login user>

where "current login user" is linux username.

recmach@chetan-HP-ENVY-15-Notebook-PC:~/hadoop/hadoop-2.6.1/sbin$ hadoop fs -ls /home/recmach ls: `/home/recmach': No such file or directory

/home/recmarch doesn't exist on HDFS and hence error. Try following command

hadoop fs -mkdir -p /home/recmarch

Upvotes: 3

Related Questions