在Hadoop文件系统中复制本地文件 [英] Copy local files in Hadoop File System

查看:235
本文介绍了在Hadoop文件系统中复制本地文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以编程方式在HDFS中复制文件的最快方法是什么?我尝试了DistCp,但无法获得相应的内容。

解决方案

  FileSystem fs = FileSystem.get(CONF); 
fs.copyFromLocalFile(new Path(/ home / me / localdirectory /),new Path(/ me / hadoop / hdfsdir));

DistCp仅适用于群集内(从hdfs到hdfs)。


What is the fastest way to copy files in HDFS in programmatic way ? I have tried for DistCp but couldn't get the appropriate content

解决方案

 FileSystem fs = FileSystem.get(conf);
 fs.copyFromLocalFile(new Path("/home/me/localdirectory/"),   new Path("/me/hadoop/hdfsdir"));

DistCp works only intra-cluster (from hdfs to hdfs).

这篇关于在Hadoop文件系统中复制本地文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆