关于hdfs中传输文件
我需要用java代码将文件从一个hdfs文件夹传输到另一个hdfs文件夹。
请问有没有可以调用的api来在hdfs路径之间传输文件?
另外我想问是否有办法从java代码调用mapreduce作业?当然,这个java不是运行在hdfs上的。
非常感谢您,祝您周末愉快!
I need to transfer files from one hdfs folder to another hdfs folder in java code.
May I ask is there api that we can call to transfer files among hdfs paths?
Also I'd like to ask is there anyway to invoke a mapreduce job from java code? Of course, this java not running in hdfs.
Thank you very much and have a great weekend!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用 oahdfs.DistributedFileSystem#rename 方法将文件从 HDFS 中的一个文件夹移动到另一个文件夹。该函数已重载,并且其中一个方法采用 Options.Rename 作为参数。
仅供参考......我还没有检查代码,但我认为重命名涉及名称空间的更改,而不是任何实际的块移动。
Hadoop是用Java编写的,所以应该有一种方法:)使用 oahmapreduce.Job#submit 和 oahmapreduce.Job #waitForCompletion 方法。
Use the o.a.h.hdfs.DistributedFileSystem#rename method to move file from one folder in HDFS to another folder. The function has been overloaded and one of the method takes Options.Rename as a parameter.
FYI .... I haven't checked the code, but I think that rename involves changes to the name space and not any actual block movements.
Hadoop is written in Java, so there should be a way :) Use the o.a.h.mapreduce.Job#submit and o.a.h.mapreduce.Job#waitForCompletion methods.