1

I am bit new to hadoop. I have recently install a stable version of Apache Hadoop 2.7.2 on ubuntu 14.04 OS.

I am trying to execute some basic Hadoop command such as follow

hadoop version

The command gives me the correct output as follows that is correct.

enter image description here However, when I try to execute the hadoop fs -ls, it give me error.

enter image description here

I have searched the previous question related to this problem on stackoverflow such as StackoverflowQuestion. But, I am not finding /user directory in my hadoop installation. Could you please help me how can I resolve this issue?

The content of my .bashrc file is as follows: enter image description here

The content of hdfs-site.xml file is as follows: enter image description here

Community
  • 1
  • 1
user-517752
  • 1,188
  • 5
  • 21
  • 54
  • Posibilly duplicate http://stackoverflow.com/questions/28241251/hadoop-fs-ls-results-in-no-such-file-or-directory – BruceWayne Jan 03 '17 at 11:23

2 Answers2

1

First of all the command "hadoop fs -ls" is a command to the HDFS file system and not a Linux command.

Second, the command as you typed it is incomplete. The correct syntax is "hadoop fs -ls [-d] [-h] [-R] " where the [-d], [-h] and [-R] components of the command are optional. That said, you MUST specify a path for the "args" component. The "args" component of the command expects an HDFS path (e.g. substituting / for "args" will list the entire tree ** ON HDFS ** starting at the HDFS root directory /). You will need to create a directory called "user" on HDFS under the root directory using "hadoop fs -mkdir /user". The the command "hadoop fs -ls /user" will work and will show an empty user directory.

Third, there is no way to tell HDFS to use a value for the "args" by supplying it a value of a local filesystem (Linux) path ...which is what you are attempting or understanding it to be. Any value for "args" must resolve to an HDFS filesystem path and not a Linux filesystem path.

Fourth, for newcomers to Hadoop, it is very important to have a clear distinction between the native host operating system filesystem (in this case Linux filesystem) and the Hadoop filesystem (in this case HDFS).

BDBoss
  • 120
  • 2
0

one thing to note when doing a hadoop commands in v2.7.2 is that, hadoop works on top of Linux OS, hence when we want to access into Hadoop Distributed File System, we would use something like this command; hdfs dfs -ls / instead of hadoop fs -ls.

Also, in your hdfs-site.xml configurations, you seemed to miss out adding this properties.

<property>
<name>dfs.datanode.dir</name>
<value>file://path/to/datanode</value>
</property>

Please take note of your $HADOOP_HOME as well.

SiHa
  • 7,830
  • 13
  • 34
  • 43
nimaomao
  • 61
  • 1
  • 1
  • 12