运行 Hadoop 中 map-reduce jar 的替代方案

Alternatives for running a map-reduce jar in Hadoop

我知道 hadoop jar 命令用于 运行 Hadoop 中的 Map-Reduce jar,但是有这个 setJar(String jar) method in the Job class of the Map-Reduce API. This page of the API documentation 提到 Jar 作为作业的参数 class。

因此我想知道除了 hadoop jar 之外是否有任何方法可以 运行 jar 文件,以及这个 setJar() 方法的作用是什么。

任何帮助都会很棒。 TIA :)

hadoop 内部试图找到作业 jar,为此,您的作业 类 必须打包到作业 JAR 中。所以 setJar() 和 setJarByClass() 什么都不做。

见于Hadoop: The Definitive Guide, 4th Edition by Tom White

For a start, a job’s classes must be packaged into a job JAR file to send to the cluster. Hadoop will find the job JAR automatically by searching for the JAR on the driver’s classpath that contains the class set in the setJarByClass() method (on JobConf or Job). Alternatively, if you want to set an explicit JAR file by its file path, you can use the setJar() method. (The JAR file path may be local or an HDFS file path.)