Hadoop -copyFromLocal cant find the destination - hadoop

I try to copy file from local to hadoop file system...
I'm using single node cluster
hduser#jothinathan-VirtualBox:~$ hdfs dfs -mkdir -p /usr/hduser
hduser#jothinathan-VirtualBox:~$ hadoop fs -ls
Found 1 items
drwxr-xr-x - hduser supergroup 0 2015-03-10 18:33 sample
hduser#jothinathan-VirtualBox:~$ cd Documents
hduser#jothinathan-VirtualBox:~/Documents$ ls
file hadoopFIle.txt URICat URICat.java
hduser#jothinathan-VirtualBox:~/Documents$ cd
hduser#jothinathan-VirtualBox:~$ hadoop fs -copyFromLocal /Documents/file /usr/local/hadoop
copyFromLocal: `/usr/local/hadoop': No such file or directory
I am getting this error message, please help me with this problem.

first try this command.
hadoop fs -ls /
if it is listing out the local file system files.(not hdfs),then try
hadoop fs -ls hdfs://IP-ADDRESS-of your-machine/
now copy your file to hdfs by
hadoop fs -copyFromLocal /Documents/file hdfs://Ip-addressofyourmachine/above result path

Related

Issue in copying file from local file system to hdfs

While firing this command, it throws an error
hdfs dfs -copyFromLocal /home/osboxes/sample new
copyFromLocal: `new': No such file or directory"
hdfs dfs -ls gives" ls: `.': No such file or directory"
You don't have a HDFS user directory to copy anything into
Verify by hdfs dfs -ls /user | grep $(whoami)
You need to make this folder before you can really do anything useful such as running MapReduce, or copying files into the relative path of the user folder such as you've done
hdfs dfs -mkdir -p "/user/$(whoami)"
hdfs dfs -chown -R $(whoami) "/user/$(whoami)"
Then run your copy command
Or give a different path hdfs dfs -copyFromLocal file /tmp/somePlace

Store file on hadoop

I want to store some .tbl files in hadoop.
I am using this command: hadoop fs -put customer.tbl
But Im getting:
Usage: java FsShell [- put <localsrc> .. <dst>]
If I do hadoop fs -cat cusomer.tbl
It appears that file does note exist.
It seems like you need to provide local-src and HDFS-dst.
Can you try to add destination?
e.g. hadoop fs -put customer.tbl .
please also try execute "ls" on the HDFS:
hadoop fs -ls
please also try execute "ls" on the HDFS using hdfs command, 'hdfs' should be found under hadoop-version-number/bin/:
hdfs dfs -ls

Hadoop - Recursive copy/put from local to HDFS

I can use hadoop fs -put local hdfs to copy from local to HDFS. Is there a way to do recursive put? Tried -put -r and it doesnt work.
Try this command
hadoop fs -copyFromLocal docs/* /input/
Where /input/ is the path of the HDFS location where you want to store.
hadoop fs -copyFromLocal local/* /Hdfs/

Hadoop access HDFS

I have installed hadoop and I can't use -copyFromLocal , it responses
[root#hadoop-master ~]# hadoop fs -copyFromLocal file.dat
copyFromLocal: `.': No such file or directory
I have tryed -mkdir dir but it responses
[root#hadoop-master ~]# hadoop fs -mkdir dir
mkdir: `dir': No such file or directory
and -ls
[root#hadoop-master ~]# hadoop fs -ls
ls: `.': No such file or directory
Only it works when I change my user
su hdfs
hadoop fs -mkdir tfm
but it fails when I try again -copyFromLocal
Any solution?
Try the following
hadoop fs -ls /
hadoop fs -lsr /
hadoop fs -mkdir /dir
hadoop fs -copyFromLocal localfilename /newlocation
HDFS is the Owner of the Hadoop file system so you are able to create directories using HDFS user refer bellow mention commands to create directory or to copy files
sudo -u hdfs hadoop fs -mkdir /path/dir
sudo -u hdfs hadoop fs -copyFromLocal localpath hdfspath
or make sure the user (from whom your are running the command) have needed permissions on the directory you are running the command.

why does my hadoop command does not work?

I have my hadoop cluster set up with one master and two slaves.
when I type
hadoop fs -ls
ls: Cannot access .: No such file or directory.
But when I type the following:
hadoop fs -ls /
Found 1 items
drwxr-xr-x - Mike supergroup 0 2014-06-24 00:24 /usr
I get the same output both on master and slaves. why hadoop fs -ls does not work?
Thanks!
hadoop fs -ls
This tries to list current user's home directory on hdfs. since i think /user/{username} directory doesn't exist in your case hence you get the error,
hadoop fs -ls /
you are specifically telling it to list root directory which it does successfully as it exist.

Resources