关于hdfs中传输文件

发布于 2024-12-27 10:29:13 字数 164 浏览 5 评论 0原文

我需要用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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

毁梦 2025-01-03 10:29:13

请问有没有可以调用的api来在hdfs路径之间传输文件?

使用 oahdfs.DistributedFileSystem#rename 方法将文件从 HDFS 中的一个文件夹移动到另一个文件夹。该函数已重载,并且其中一个方法采用 Options.Rename 作为参数。

仅供参考......我还没有检查代码,但我认为重命名涉及名称空间的更改,而不是任何实际的块移动。

另外我想问是否有办法从java代码调用mapreduce作业?当然,这个java没有运行在hdfs中。

Hadoop是用Java编写的,所以应该有一种方法:)使用 oahmapreduce.Job#submitoahmapreduce.Job #waitForCompletion 方法。

May I ask is there api that we can call to transfer files among hdfs paths?

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.

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.

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文