我一直在this tutorial以便在一台Windows机器上设置hadoop。 NameNode和JobTracker服务分别在http://localhost:50070和http://localhost:50030上运行。当我在本地hadoop服务器(right click on TestDriver.java > run as > Run on Hadoop
)上启动Map / Reduce驱动程序时,我有以下输出:
12/01/11 20:04:11 WARN mapred.JobClient: Use GenericOptionsParser for parsing the arguments. Applications should implement Tool for the same.
12/01/11 20:04:11 INFO mapred.FileInputFormat: Total input paths to process : 5
12/01/11 20:04:11 INFO mapred.JobClient: Running job: job_201201112003_0001
12/01/11 20:04:12 INFO mapred.JobClient: map 0% reduce 0%
12/01/11 20:04:21 INFO mapred.JobClient: Task Id : attempt_201201112003_0001_m_000000_0, Status : FAILED
java.io.IOException: Type mismatch in key from map: expected org.apache.hadoop.io.Text, recieved org.apache.hadoop.io.LongWritable
at org.apache.hadoop.mapred.MapTask$MapOutputBuffer.collect(MapTask.java:558)
at org.apache.hadoop.mapred.lib.IdentityMapper.map(IdentityMapper.java:37)
at org.apache.hadoop.mapred.MapRunner.run(MapRunner.java:50)
at org.apache.hadoop.mapred.MapTask.run(MapTask.java:342)
at org.apache.hadoop.mapred.Child.main(Child.java:158)
[Previous block is repeated 2 times, the task id changes]
java.io.IOException: Job failed!
at org.apache.hadoop.mapred.JobClient.runJob(JobClient.java:1232)
at driverPkg.TestDriver.main(TestDriver.java:42)
你知道发生了什么吗?
答案 0 :(得分:1)
这是相关的一行:
来自地图的键中键入不匹配:期望org.apache.hadoop.io.Text, 收到的org.apache.hadoop.io.LongWritable
看起来你的Mapper是用TextWritable输出定义的(查看Mapper类中的<>和Map方法),但是你输出的是LongWritable。要么改变定义,要么改变你所写的内容。
答案 1 :(得分:0)
您可以使用KeyValueTextInput格式而不是TextInputFormat来临时解决此问题。
请查看以下链接以获取详细示例。
http://sanketraut.blogspot.in/2012/06/hadoop-example-setting-up-hadoop-on.html
和平。 Sanket Raut