如何将文件从HDFS复制到本地文件系统?

时间:2021-09-19 14:54:28

How to copy file from HDFS to the local file system . There is no physical location of a file under the file , not even directory . how can i moved them to my local for further validations.i am tried through winscp .

如何将文件从HDFS复制到本地文件系统。文件下没有物理位置,甚至目录也没有。我怎样才能将它们转移到本地进行进一步验证。我试过winscp。

6 个解决方案

#1


159  

  1. bin/hadoop fs -get /hdfs/source/path /localfs/destination/path
  2. bin/hadoop fs -get /hdfs/source/path /localfs/destination/path。
  3. bin/hadoop fs -copyToLocal /hdfs/source/path /localfs/destination/path
  4. bin/hadoop fs -copyToLocal /hdfs/source/path /localfs/destination/path。
  5. Point your web browser to HDFS WEBUI(namenode_machine:50070), browse to the file you intend to copy, scroll down the page and click on download the file.
  6. 将您的web浏览器指向HDFS WEBUI(namenode_machine:50070),浏览您想要复制的文件,向下滚动页面并单击下载文件。

#2


11  

In order to copy files from HDFS to the local file system the following command could be run:

为了将文件从HDFS复制到本地文件系统,可以运行以下命令:

hadoop dfs -copyToLocal <input> <output>

hadoop dfs -copyToLocal <输入> <输出> 。

  • <input>: the HDFS directory path (e.g /mydata) that you want to copy
  • <输入> :HDFS目录路径(e)。你要复制的g /mydata。
  • <output>: the destination directory path (e.g. ~/Documents)
  • <输出> :目标目录路径(如~/文档)

#3


8  

In Hadoop 2.0,

在Hadoop 2.0中,

hdfs dfs -copyToLocal <hdfs_input_file_path> <output_path>

where,

在那里,

  • hdfs_input_file_path maybe obtained from http://<<name_node_ip>>:50070/explorer.html

    hdfs_input_file_path可能是从http://< >:50070/explorer.html中获得的。

  • output_path is the local path of the file, where the file is to be copied to.

    output_path是文件的本地路径,该文件将被复制到文件中。

  • you may also use get in place of copyToLocal.

    你也可以使用get代替copyToLocal。

#4


3  

you can accomplish in both these ways.

这两种方法都可以实现。

1.hadoop fs -get <HDFS file path> <Local system directory path>
2.hadoop fs -copyToLocal <HDFS file path> <Local system directory path>

Ex:

例:

My files are located in /sourcedata/mydata.txt I want to copy file to Local file system in this path /user/ravi/mydata

我的文件位于/sourcedata/mydata中。在此路径/用户/ravi/mydata中,我希望将文件复制到本地文件系统。

hadoop fs -get /sourcedata/mydata.txt /user/ravi/mydata/

#5


0  

This worked for me on my VM instance of Ubuntu.

这对我在Ubuntu的VM实例上起了作用。

hdfs dfs -copyToLocal [hadoop directory] [local directory]

hdfs dfs -copyToLocal [hadoop目录][本地目录]

#6


-3  

bin/hadoop fs -put /localfs/destination/path /hdfs/source/path 

#1


159  

  1. bin/hadoop fs -get /hdfs/source/path /localfs/destination/path
  2. bin/hadoop fs -get /hdfs/source/path /localfs/destination/path。
  3. bin/hadoop fs -copyToLocal /hdfs/source/path /localfs/destination/path
  4. bin/hadoop fs -copyToLocal /hdfs/source/path /localfs/destination/path。
  5. Point your web browser to HDFS WEBUI(namenode_machine:50070), browse to the file you intend to copy, scroll down the page and click on download the file.
  6. 将您的web浏览器指向HDFS WEBUI(namenode_machine:50070),浏览您想要复制的文件,向下滚动页面并单击下载文件。

#2


11  

In order to copy files from HDFS to the local file system the following command could be run:

为了将文件从HDFS复制到本地文件系统,可以运行以下命令:

hadoop dfs -copyToLocal <input> <output>

hadoop dfs -copyToLocal <输入> <输出> 。

  • <input>: the HDFS directory path (e.g /mydata) that you want to copy
  • <输入> :HDFS目录路径(e)。你要复制的g /mydata。
  • <output>: the destination directory path (e.g. ~/Documents)
  • <输出> :目标目录路径(如~/文档)

#3


8  

In Hadoop 2.0,

在Hadoop 2.0中,

hdfs dfs -copyToLocal <hdfs_input_file_path> <output_path>

where,

在那里,

  • hdfs_input_file_path maybe obtained from http://<<name_node_ip>>:50070/explorer.html

    hdfs_input_file_path可能是从http://< >:50070/explorer.html中获得的。

  • output_path is the local path of the file, where the file is to be copied to.

    output_path是文件的本地路径,该文件将被复制到文件中。

  • you may also use get in place of copyToLocal.

    你也可以使用get代替copyToLocal。

#4


3  

you can accomplish in both these ways.

这两种方法都可以实现。

1.hadoop fs -get <HDFS file path> <Local system directory path>
2.hadoop fs -copyToLocal <HDFS file path> <Local system directory path>

Ex:

例:

My files are located in /sourcedata/mydata.txt I want to copy file to Local file system in this path /user/ravi/mydata

我的文件位于/sourcedata/mydata中。在此路径/用户/ravi/mydata中,我希望将文件复制到本地文件系统。

hadoop fs -get /sourcedata/mydata.txt /user/ravi/mydata/

#5


0  

This worked for me on my VM instance of Ubuntu.

这对我在Ubuntu的VM实例上起了作用。

hdfs dfs -copyToLocal [hadoop directory] [local directory]

hdfs dfs -copyToLocal [hadoop目录][本地目录]

#6


-3  

bin/hadoop fs -put /localfs/destination/path /hdfs/source/path