Error while copying the file from local to HDFS

0 votes

I am following a hdfs tutorial for learning different hdfs commands. So far I am able to create a directory in hdfs using the command:

hdfs dfs -mkdir -p sales/january

But, I am getting error while copying the data from local file system to HDFS. I am following all the steps mentioned in the tutorial. Here is the screenshots:

  • Here, is my HDFS directories:
image
  • Here, is the directory where I want to copy the file

image

Now, I am issuing the following command:

hdfs dfs -put january_sales_2017.csv sales/january/january_sale_2017.csv

The error that I am getting is:

put: `sales/january/january_sale_2017.csv': No such file or directory: `hdfs://localhost:8020/sales/january/january_sale_2017.csv`

Please, let me know what I am doing wrong or is there any problem with the hadoop setup. Any help would be appreciated.

May 2, 2018 in Big Data Hadoop by Damon Salvatore
• 5,510 points
625 views

1 answer to this question.

0 votes

Well, the reason you are getting such prompt is because you trying to copy the file into a directory that does not exist. In your case, you are trying to push the files january_sales_2017.csv into sales/january/january_sales_2017.csv directory path. Now, you have not created any sub-dir by the name of january_sales_2017.csv inside sales directory and therefore, giving you the error. So, on case you want to copy the files inside sales/january directory, here is the corrected way to do it:

hdfs dfs -put january_sales_2017.csv /sales/january

answered May 2, 2018 by Ashish
• 2,630 points

Related Questions In Big Data Hadoop

0 votes
1 answer

Copy file from HDFS to the local file system

There are two possible ways to copy ...READ MORE

answered Mar 27, 2018 in Big Data Hadoop by nitinrawat895
• 10,800 points
6,952 views
0 votes
1 answer

Copy file from local to hdfs from the spark job in yarn mode

Please refer to the below code: import org.apache.hadoop.conf.Configuration import ...READ MORE

answered Jul 16 in Big Data Hadoop by Raj
807 views
0 votes
1 answer

How can I put file to HDFS directly without copying it local disk?

Can use pipe from wget to hdfs. You ...READ MORE

answered Apr 15, 2018 in Big Data Hadoop by kurt_cobain
• 9,280 points
1,077 views
0 votes
1 answer
0 votes
1 answer

Hadoop dfs -ls command?

In your case there is no difference ...READ MORE

answered Mar 16, 2018 in Big Data Hadoop by kurt_cobain
• 9,280 points
1,336 views
0 votes
1 answer

Hadoop Mapreduce word count Program

Firstly you need to understand the concept ...READ MORE

answered Mar 16, 2018 in Data Analytics by nitinrawat895
• 10,800 points
3,587 views
+1 vote
11 answers

hadoop fs -put command?

put syntax: put <localSrc> <dest> copy syntax: copyFr ...READ MORE

answered Dec 7, 2018 in Big Data Hadoop by Aditya
18,484 views
+1 vote
1 answer

Where to set hadoop.tmp.dir? core-site.xml or hdfs-site.xml?

hadoop.tmp.dir (A base for other temporary directories) is ...READ MORE

answered Mar 26, 2018 in Big Data Hadoop by nitinrawat895
• 10,800 points
2,191 views
0 votes
1 answer
0 votes
1 answer

What is the use of sequence file in Hadoop?

Sequence files are binary files containing serialized ...READ MORE

answered Apr 5, 2018 in Big Data Hadoop by Ashish
• 2,630 points
1,947 views