Hadoop Streaming 作业和常规 Java 作业有什么区别。与后者相比,使用 Hadoop 流式传输有什么优势吗?
还有一件事,我正在使用 mapreduce API(即新 API),我听说流式传输仅适用于已弃用的 mapred API。是吗 ?
最佳答案
Hadoop 流式处理对于开发人员不具备太多 Java 知识并且可以更快地使用任何脚本语言编写 Mapper/Reducer 的情况非常有利。
与自定义 jar 作业相比,流式作业还会有启动脚本(Python/Ruby/Perl)VM 的额外开销。这会导致大量的进程间通信,导致大多数情况下作业的效率降低。
使用 Hadoop 流式处理会带来对输入/输出格式的限制。有时您想要创建自定义输入/输出格式,使用自定义 jar 将是自然的选择。此外,使用 Java 可以根据需要/选择覆盖/扩展 hadoop 的许多功能。
引用一个答案here :
Hadoop do has capability to work with MR jobs created in other languages - it is called streaming. This model only allow us to define mapper and reducer with some restrictions not present in java. In the same time - input/output formats and other plugins do have to be written as java classes So I would define decision making as following:
- Use Java, unless you have serious codebase you need to resue in Your MR job.
- Consider to use python when you need to create some simple ad hoc jobs.
至于流式传输仅适用于mapred
API,没有意义。虽然使用流式映射器/缩减器是用另一种语言编写的,因此不必担心 hadoop 内部将使用哪个 API 来执行它们。
关于java - Hadoop Streaming 工作与常规工作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19681455/