Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
+10 votes
3 views
in Big Data Hadoop & Spark by (1.5k points)

I tried moving the files using WinSCP, but it didn’t help. So, I wanna know how can I copy files from HDFS to my local computer file system.

4 Answers

+15 votes
by (13.2k points)

There are two approaches you can use to do the task,

hadoop fs -get <HDFS file path> <Local system directory path>

hadoop fs -copyToLocal <HDFS file path> <Local system directory path>

Another thing you can try and do is simply download it with your web browser.

If you wish to know about Hadoop and Big Data visit this Hadoop Certification.

0 votes
by (106k points)
You can copy the data from hdfs to the local filesystem by following two ways:
  • bin/hadoop fs -get /hdfs/source/path /localfs/destination/path
  •  bin/hadoop fs -copyToLocal /hdfs/source/path /localfs/destination/path
Another alternative way would be:

Download the file from hdfs to the local filesystem. Just, point your web browser to HDFS WEBUI(namenode_machine:50070) and select the file and download it.

0 votes
by (33.1k points)

In Hadoop 2.0,

hdfs dfs -copyToLocal <hdfs_input_file_path> <output_path>

where, the hdfs_input_file_path maybe obtained from http://<<name_node_ip>>:50070/explorer.html and the output_path is that local path, where the file is being copied.

Refer to the following video, regarding Hadoop:

0 votes
by (3.1k points)

To copy a file from HDFS (Hadoop Distributed File System) to the local file system, you can use any of the following methods:

1. hadoop fs -get:

hadoop fs -get /user/hadoop/transferfile.txt /home/user/transferfile.txt

Explanation:

The first argument, /user/hadoop/transferfile.txt, is the path of the file in HDFS.
The second argument, /home/user/transferfile.txt, is the path where you want to save the file on your local system.

2.hadoop fs -copyToLocal:
hadoop fs -copyToLocal /user/hadoop/transferfile.txt /home/user/transferfile.txt

3.hadoop fs -cat with Redirection
hadoop fs -cat /user/hadoop/transferfile.txt /home/user/transferfile.txt

Related questions

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...