【问题标题】:Runnning Hadoop map-reduce job remotely causes EOFException?远程运行 Hadoop mapreduce 作业会导致 EOFException?
【发布时间】:2012-11-06 17:59:51
【问题描述】:

我已经编写了一个 Hadoop map-reduce 程序,现在我想在 Cloadera Hadoop distribution 上测试它,该程序在 virtual box 的同一台计算机上运行。

这里是我如何提交 map-reduce 作业:

public class AvgCounter extends Configured implements Tool{

    public int run(String[] args) throws Exception {
        Job mrJob = Job.getInstance(new Cluster(getConf()), getConf()); 
        mrJob.setJobName("Average count");

        mrJob.setJarByClass(AvgCounter.class);
        mrJob.setOutputKeyClass(IntWritable.class);
        mrJob.setOutputValueClass(Text.class);
        mrJob.setMapperClass(AvgCounterMap.class);
        mrJob.setCombinerClass(AvgCounterReduce.class);
        mrJob.setReducerClass(AvgCounterReduce.class);
        mrJob.setInputFormatClass(TextInputFormat.class);
        mrJob.setOutputFormatClass(TextOutputFormat.class);

        FileInputFormat.setInputPaths(mrJob, new Path("/user/test/testdata.csv"));
        FileOutputFormat.setOutputPath(mrJob, new Path("/user/test/result.txt"));
        mrJob.setWorkingDirectory(new Path("/tmp"));
        return mrJob.waitForCompletion(true)? 1: 0;
    }

    public static void main(String[] args) throws Exception {
        Configuration conf = new Configuration();
        conf.set("fs.defaultFS", "hdfs://192.168.5.50:9000");
        conf.set("mapreduce.jobtracker.address", "192.168.5.50:9001");
        System.exit(ToolRunner.run(conf, new AvgCounter(), args));
    }
}

AvgCounterMap 有空的 map 方法什么都不做,AvgCounterReduce 有空的 reduce 方法什么也不做。当我尝试运行 main 方法时,出现以下异常:

Exception in thread "main" java.io.IOException: Call to /192.168.5.50:9001 failed on local exception: java.io.EOFException
    at org.apache.hadoop.ipc.Client.wrapException(Client.java:1063)
    at org.apache.hadoop.ipc.Client.call(Client.java:1031)
    at org.apache.hadoop.ipc.WritableRpcEngine$Invoker.invoke(WritableRpcEngine.java:198)
    at $Proxy0.getProtocolVersion(Unknown Source)
    at org.apache.hadoop.ipc.WritableRpcEngine.getProxy(WritableRpcEngine.java:235)
    at org.apache.hadoop.ipc.RPC.getProxy(RPC.java:275)
    at org.apache.hadoop.ipc.RPC.getProxy(RPC.java:249)
    at org.apache.hadoop.mapreduce.Cluster.createRPCProxy(Cluster.java:86)
    at org.apache.hadoop.mapreduce.Cluster.createClient(Cluster.java:98)
    at org.apache.hadoop.mapreduce.Cluster.<init>(Cluster.java:74)
    at eu.xxx.mapred.AvgCounter.run(AvgCounter.java:22)
    at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:69)
    at eu.xxx.mapred.AvgCounter.main(AvgCounter.java:53)
Caused by: java.io.EOFException
    at java.io.DataInputStream.readInt(DataInputStream.java:375)
    at org.apache.hadoop.ipc.Client$Connection.receiveResponse(Client.java:760)
    at org.apache.hadoop.ipc.Client$Connection.run(Client.java:698) 

运行 Hadoop 的虚拟 Cloudera 机器在文件 /etc/hadoop/conf/core.site.xml 中有以下内容

<property>
    <name>fs.default.name</name>
    <value>hdfs://192.168.5.50:9000</value>
</property> 

在文件/etc/hadoop/conf/mapred.site.xml中有

<property>
     <name>mapred.job.tracker</name>
     <value>192.168.5.50:9001</value>
</property>

我还通过将92.168.5.50:50030 写入我的Web 浏览器检查了与虚拟机的连接,并且我得到了预期的Hadoop Map/Reduce 管理。那么是什么导致了这个异常,我该如何摆脱它呢?

感谢您的任何想法

【问题讨论】:

  • 我也尝试在 Cloudera 机器上杀死 iptables,但没有结果。
  • 你能从tasktracker ping这两个ip吗?
  • 你在混合库吗(客户端使用apache hadoop,服务器端是cloudera hadoop?)

标签: java hadoop mapreduce remote-access cloudera


【解决方案1】:

问题在于客户端使用的 Hadoop API (0.23.0) 版本与 Hadoop 安装不同。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-08-20
    • 2019-03-26
    • 2013-01-16
    • 1970-01-01
    相关资源
    最近更新 更多