Hadoop Hdfs Showing Ls: '/Home/Hduser/Input/': No Such File or Directory Error

Hadoop hdfs showing ls: `/home/hduser/input/': No such file or directory error

You are trying to access you local directory using hdfs. Try following steps:

export PATH=$HADOOP_HOME/bin:$PATH ##Make this entry in your ~/.bashrc file
hdfs dfs -mkdir /user
hdfs dfs -mkdir /user/hduser
hdfs dfs -mkdir /user/hduser/input
hdfs dfs -ls /user/hduser/input
echo "Hello World" > file01
hadoop fs -copyFromLocal /user/hduser/input
hadoop fs -cat /user/hduser/input/file01

hadoop fs -ls results in no such file or directory

The behaviour that you are seeing is expected, let me explain what's going on when you are working with hadoop fs commands.

The command's syntax is this: hadoop fs -ls [path]

By default, when you don't specify [path] for the above command, hadoop expands the path to /home/[username] in hdfs; where [username] gets replaced with linux username who is executing the command.

So, when you execute this command:

ubuntu@xad101-master:~$ hadoop fs -ls

the reason you are seeing the error is ls: '.': No such file or directory because hadoop is looking for this path /home/ubuntu, it seems like this path doesn't exist in hdfs.

The reason why this command:

ubuntu@101-master:~$ hadoop fs -ls hdfs://101-master:50000/

is working because, you have explicitly specified [path] and is the root of the hdfs. You can also do the same using this:

ubuntu@101-master:~$ hadoop fs -ls /

which automatically gets evaluated to the root of hdfs.

Hope, this clears the behaviour you are seeing while executing hadoop fs -ls command.

Hence, if you want to specify local file system path use file:/// url scheme.

hdfs dfs -mkdir, No such file or directory

It is because the parent directories do not exist yet either. Try hdfs dfs -mkdir -p /user/Hadoop/twitter_data. The -p flag indicates that all nonexistent directories leading up to the given directory are to be created as well.

As for the question you posed in the comments, simply type into your browser http://<host name of the namenode>:<port number>/.

No such file or directory with hdfs

Might be running into a shell expansion. Try a full path to the destination:

hdfs dfs -put /home/user_name/file_name.csv /tempfolder

copyFromLocal: `/user/hduser/input': No such file or directory


hadoop fs -copyFromLocal /user/hduser/directory_in_local_fs /user/hduser/directory_in_hadoop_fs

copied directory_in_local_fs (local file or dicectory) into directory_in_hadoop_fs (path hadoop file system)

Hadoop 2.2 Installation `.' no such file or directory

Well, your problem regarding ls: '.': No such file or directory' is because, there is no home dir on HDFS for your current user. Try

hadoop fs -mkdir -p /user/[current login user]

Then you will be able to hadoop fs -ls

As per this warning WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable, please see my answer at this question



Related Topics



Leave a reply



Submit