Error creating file from hdfs to local file system



0

[cloudera@localhost ~]$ sudo -u hdfs hadoop fs -copyToLocal /dezyre/new.txt /local.txt
copyToLocal: mkdir `/local.txt': Input/output error
[cloudera@localhost ~]$ 


5 Answer(s)


0

Hi Ritu,

You don't have sufficient permission to create file under /local.txt (root directory). Please use the command to create a file in default local directory(/home/cloudera) with full permission:

$ hadoop fs -copyToLocal /dezyre/new.txt local.txt

Note: You don't need sudo permission for this. "sudo -u hdfs" is used for provide superuser access while performing some task over hdfs.

Hope this helps.

Thanks.


0

Hi Ritu,

Please share the output of the following command:

  1. $ hadoop fs -ls /dezyre/
  2. $ ls -l /home/cloudera/

0

Now the problem is with copying file from local to hdfs

here are the steps:

cloudera@localhost ~]$ ls
datasets  Documents  hadoopFile.txt  new.txt   Templates  workspace
Desktop   Downloads  lib             Pictures  Videos
dezyre    eclipse    Music           Public    wordcount

[cloudera@localhost ~]$  hadoop fs -copyFromLocal hadoopFile.txt /dezyre

copyFromLocal: Permission denied: user=cloudera, access=WRITE, inode="/dezyre":hdfs:supergroup:drwxr-xr-x

[cloudera@localhost ~]$ sudo -u hdfs hadoop fs -copyFromLocal hadoopFile.txt /dezyre
copyFromLocal: `hadoopFile.txt': No such file or directory
[cloudera@localhost ~]$ 

 


0

Here is the output for commnds

  1. $ hadoop fs -ls /dezyre/
  2. $ ls -l /home/cloudera/

[cloudera@localhost ~]$ hadoop fs -ls /dezyre/
Found 1 items
drwxr-xr-x   - hdfs supergroup          0 2016-10-03 19:55 /dezyre/new.txt
[cloudera@localhost ~]$ -l /home/cloudera/
bash: -l: command not found
[cloudera@localhost ~]$ ls -l /home/cloudera/
total 64
drwxr-xr-x. 2 cloudera cloudera 4096 Oct  7  2013 datasets
drwxr-xr-x. 2 cloudera cloudera 4096 Oct  7  2013 Desktop
drwxrwxr-x  2 cloudera cloudera 4096 Oct  3 18:58 dezyre
drwxr-xr-x. 3 cloudera cloudera 4096 Oct  7  2013 Documents
drwxr-xr-x  2 cloudera cloudera 4096 Sep 20 11:31 Downloads
drwxrwsr-x. 9 cloudera cloudera 4096 Feb 24  2013 eclipse
-rw-rw-r--  1 cloudera cloudera  104 Oct  4 13:10 hadoopFile.txt
drwxr-xr-x. 2 cloudera cloudera 4096 Oct  7  2013 lib
drwxr-xr-x  2 cloudera cloudera 4096 Sep 20 11:31 Music
drwxrwxr-x  3 cloudera cloudera 4096 Oct  4 13:07 new.txt
drwxr-xr-x  2 cloudera cloudera 4096 Sep 20 11:31 Pictures
drwxr-xr-x  2 cloudera cloudera 4096 Sep 20 11:31 Public
drwxr-xr-x  2 cloudera cloudera 4096 Sep 20 11:31 Templates
drwxr-xr-x  2 cloudera cloudera 4096 Sep 20 11:31 Videos
drwxrwxr-x  3 cloudera cloudera 4096 Oct  3 12:56 wordcount
drwxr-xr-x. 4 cloudera cloudera 4096 Oct  7  2013 workspace
[cloudera@localhost ~]$ 
 


0

Hi Ritu,

Please use the command:

$ sudo -u hdfs hadoop fs -chown -R cloudera:cloudera /dezyre 
$ hadoop fs -put hadoopFile.txt /dezyre

Hope this helps.

Thanks

Your Answer

Click on this code-snippet-icon icon to add code snippet.

Upload Files (Maximum image file size - 1.5 MB, other file size - 10 MB, total size - not more than 50 MB)

Email
Password