【问题标题】:Passing directories to hadoop streaming : some help needed将目录传递给 hadoop 流:需要一些帮助
【发布时间】:2013-03-01 10:56:40
【问题描述】:

上下文是我正在尝试使用我运行的 bash 脚本在 Amazon EMR (Web UI) 上运行流式作业:

-input s3://emrdata/test_data/input -output s3://emrdata/test_data/output -mapper
s3://emrdata/test_data/scripts/mapperScript.sh -reducer NONE

输入目录中包含子目录,这些子目录包含压缩后的数据文件。

mapperScript.sh 失败的相关部分是:

for filename in "$input"/*; do

dir_name=`dirname $filename`
fname=`basename $filename`

echo "$fname">/dev/stderr

modelname=${fname}.model

modelfile=$model_location/$modelname

echo "$modelfile">/dev/stderr

inputfile=$dirname/$fname

echo "$inputfile">/dev/stderr

outputfile=$output/$fname

echo "$outputfile">/dev/stderr

# Will do some processing on the files in the sub-directories here

done # this is the loop for getting input from all sub-directories

基本上,我需要以流模式读取子目录,当我运行它时,hadoop 抱怨说:

2013-03-01 10:41:26,226 ERROR
org.apache.hadoop.security.UserGroupInformation (main):               
PriviledgedActionException as:hadoop cause:java.io.IOException: Not a
file:      s3://emrdata/test_data/input/data1 2013-03-01 10:41:26,226
ERROR org.apache.hadoop.streaming.StreamJob (main):  Error Launching
job : Not a file: s3://emrdata/test_data/input/data1

我知道有人问过类似的问题here

那里的建议是编写自己的 InputFormat。我想知道在编写脚本/给出 EMR 输入的方式上是否遗漏了其他内容,或者用 Java 编写自己的 InputFormat 是否是我唯一的选择。

我也尝试将我的输入与“输入/*”一起提供给 EMR,但没有成功。

【问题讨论】:

  • 您是否已经查看了wiki.apache.org/hadoop/AmazonS3 并检查了您的 fs.default.name 等设置?
  • 你也试过input path/*/*吗?
  • 迈克尔,是的,我确实这样做了。这些设置看起来不错,此外,当没有子目录传递给流脚本时,它们也能完美运行。
  • Amar - 不,没有尝试过。我会这样做并检查它是否有帮助,谢谢!

标签: shell hadoop streaming amazon emr


【解决方案1】:

似乎虽然可能有一些临时的解决方法,但 hadoop 本身并不支持这一点,因为您可能会看到这个here 上有一张未结的票。 所以inputpatth/*/* 可能适用于 2 级子目录,它可能无法进一步嵌套。

您现在可以做的最好的事情是获取文件/文件夹的列表 - without-any-subdirectory 并在创建 inputPaths 的 csv 列表后递归地添加它们。为此,您可以使用 s3cmd 等单一工具。

【讨论】:

    猜你喜欢
    • 2018-11-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-01-13
    • 1970-01-01
    • 2020-02-29
    • 1970-01-01
    相关资源
    最近更新 更多