python - 在 Hadoop Streaming 中使用象鸟输入格式时出错

标签 python hadoop lzo

我正在尝试使用来自 Elephant Bird 的输入格式在我的 Hadoop Streaming 脚本中。特别是,我想使用 LzoInputFormat 并最终使用 LzoJsonInputFormat(在此处处理 Twitter 数据)。但是,当我尝试这样做时,我不断收到错误消息,提示 Elephant Bird 格式不是 InputFormat 类的有效实例。

这就是我运行 Streaming 命令的方式:

hadoop jar /usr/lib/hadoop/contrib/streaming/hadoop-streaming-0.20.2-cdh3u5.jar \                                                                                                          
    -libjars /project/hanna/src/elephant-bird/build/elephant-bird-2.2.0.jar \                                                                                                              
    -D stream.map.output.field.separator=\t \                                                                                                                                              
    -D stream.num.map.output.key.fields=2 \                                                                                                                                                
    -D map.output.key.field.separator=\t \                                                                                                                                                 
    -D mapred.text.key.partitioner.options=-k1,2 \                                                                                                                                         
    -file /home/a/ahanna/sandbox/hadoop-textual-analysis/streaming/filter/filterMap.py \                                                                                                   
    -file /home/a/ahanna/sandbox/hadoop-textual-analysis/streaming/filter/filterReduce.py \                                                                                                
    -file /home/a/ahanna/sandbox/hadoop-textual-analysis/streaming/data/latinKeywords.txt \                                                                                                
    -inputformat com.twitter.elephantbird.mapreduce.input.LzoTextInputFormat \                                                                                                             
    -input /user/ahanna/lzotest \                                                                                                                                                          
    -output /user/ahanna/output \                                                                                                                                                          
    -mapper filterMap.py \                                                                                                                                                                 
    -reducer filterReduce.py \                                                                                                                                                             
    -partitioner org.apache.hadoop.mapred.lib.KeyFieldBasedPartitioner    

这是我得到的错误:

Exception in thread "main" java.lang.RuntimeException: class com.hadoop.mapreduce.LzoTextInputFormat not org.apache.hadoop.mapred.InputFormat
    at org.apache.hadoop.conf.Configuration.setClass(Configuration.java:1078)
at org.apache.hadoop.mapred.JobConf.setInputFormat(JobConf.java:633)
at org.apache.hadoop.streaming.StreamJob.setJobConf(StreamJob.java:707)
at org.apache.hadoop.streaming.StreamJob.run(StreamJob.java:122)
at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:65)
at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:79)
at org.apache.hadoop.streaming.HadoopStreaming.main(HadoopStreaming.java:50)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.apache.hadoop.util.RunJar.main(RunJar.java:197)

最佳答案

在 hadoop 2.4 中,我设法让它运行:

-D org.apache.hadoop.mapreduce.lib.input.FileInputFormat=your.package.path.FileInputFormat

而不是标准的-inputformat

关于python - 在 Hadoop Streaming 中使用象鸟输入格式时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12937851/

相关文章:

hadoop - 使用Hadoop将非结构化数据转换为结构化数据

python - 任何用于并行和分布式任务的 python 库?

hadoop - native-lzo 库在 Hadoop 数据节点上不可用

java - 本地运行的 Hive 包含 LZO 的 native 库

python - 如何通过单击列标题按列对 QTableWidget 进行排序?

python - 在 Google App Engine 上运行 Alembic 迁移

python - 在代码中找不到语法错误

apache-spark - 每次在yarn中执行批处理作业时都会创建Spark上下文

python - 如果我有外键,我该如何在 Django 中执行此 "order by"?

java - 将 lzo 文件作为数据集导入 java Spark