只需使用
FileSystem的copyFromLocalFile方法即可。如果源路径是本地目录,它将被复制到HDFS目标:
...Configuration conf = new Configuration();conf.addResource(new Path("/home/user/hadoop/conf/core-site.xml"));conf.addResource(new Path("/home/user/hadoop/conf/hdfs-site.xml"));FileSystem fs = FileSystem.get(conf);fs.copyFromLocalFile(new Path("/home/user/directory/"), new Path("/user/hadoop/dir"));...
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)