Big Data Architect’s Handbook
上QQ阅读APP看书,第一时间看更新

Copying files from HDFS to a local file system

Now we will try to retrieve a file we put in HDFS, test.txt. The operator required for this purpose is -get. For this exercise, create a folder, hdfsfiles, in your local file system by executing the following command:

$ mkdir hdfsfiles

After creating the folder, we will extract the file from HDFS and put it in the local system by executing the following command:

$ hdfs dfs -get /hadooptest/test.txt hdfsfiles/

To verify that the file has been copied to our local file system, execute the following command:

$ ls hdfsfiles/

The output of these commands should be similar to the following screenshot:

Figure-3.2.3