【问题标题】:hadoop map-reduce: how to deploy non-jar fileshadoop map-reduce:如何部署非jar文件
【发布时间】:2016-11-16 18:01:18
【问题描述】:

您好,我想知道当我使用 hadoop jar ..args.. 提交我的 jar 以进行 map-reduce 作业时如何部署非 jar 文件。

对于 hadoop 流,有 --file 发送文件的选项,对于 spark,我们有 --files,但我在文档中找不到这样的选项。

提交 hadoop map-reduce 作业时,是否可以使用我的 jar 传送非 jar 文件?

【问题讨论】:

    标签: hadoop mapreduce


    【解决方案1】:

    Applications can specify a comma separated list of paths which would be present in the current working directory of the task using the option -files

    -libjars 选项允许应用程序将 jars 添加到 map 和 reduce 的类路径。选项 -archives 允许 他们将逗号分隔的档案列表作为参数传递。这些 存档未存档,并创建带有存档名称的链接 在任务的当前工作目录中。有关的更多详细信息 命令指南中提供了命令行选项。

    使用 -libjars、-files 和 -archives 运行 wordcount 示例:hadoop jar hadoop-examples.jar wordcount -files cachefile.txt -libjars mylib.jar -archives myarchive.zip 输入输出 这里,myarchive.zip 将按名称放置并解压缩到目录中 “myarchive.zip”。

    用户可以为文件和档案指定不同的符号名称 通过 -files 和 -archives 选项,使用 #.

    例如 hadoop jar hadoop-examples.jar wordcount -files dir1/dict.txt#dict1,dir2/dict.txt#dict2 -archives mytar.tgz#tgzdir 输入输出这里,文件dir1/dict.txt和dir2/dict.txt可以是 由使用符号名 dict1 和 dict2 的任务访问 分别。归档 mytar.tgz 将被放置并取消归档到 名为“tgzdir”的目录。

    【讨论】:

    • 我发现有人提到使用它:-cacheFile file.txt。你知道这是否与--files file.txt 做同样的事情。
    • cacheFile - 有效地分发特定于应用程序的大型只读文件。 “可以通过设置属性 mapred.cache.{files|archives} 来分发文件/存档。在 Streaming 中,可以通过命令行选项 -cacheFile/-cacheArchive 分发文件。” - 在这里查看更多信息 - hadoop.apache.org/docs/r1.0.4/…
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-07-07
    • 2012-03-14
    • 1970-01-01
    • 2011-07-21
    • 2014-03-22
    • 1970-01-01
    相关资源
    最近更新 更多