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 3, 2018 in Big Data Hadoop by Damon Salvatore
• 5,980 points
3,663 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 3, 2018 by Ashish
• 2,650 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
• 11,380 points
16,392 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, 2019 in Big Data Hadoop by Raj
10,779 views
0 votes
1 answer

Distcp From Local to HDFS giving error file not found

Hey, @Amey, This is probably because of a ...READ MORE

answered Apr 29, 2020 in Big Data Hadoop by Gitika
• 65,910 points
1,754 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,390 points
4,211 views
–1 vote
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,390 points
4,232 views
+1 vote
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
• 11,380 points
10,521 views
+2 votes
11 answers

hadoop fs -put command?

Hi, You can create one directory in HDFS ...READ MORE

answered Mar 16, 2018 in Big Data Hadoop by nitinrawat895
• 11,380 points
103,803 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
• 11,380 points
8,434 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 6, 2018 in Big Data Hadoop by Ashish
• 2,650 points
9,176 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP