简体   繁体   中英

Runnning Hadoop map-reduce job remotely causes EOFException?

I have written a Hadoop map-reduce program and now I want to test it on Cloadera Hadoop distribution that is running on the same computer in virtual box .

Here is how do I submit that map-reduce job:

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 has empty map method that does nothing as well as AvgCounterReduce has empty reduce method that does nothing. When I try to run the main method I get following exception:

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) 

The virtual Cloudera machine that runs Hadoop has following in file /etc/hadoop/conf/core.site.xml

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

and in the file /etc/hadoop/conf/mapred.site.xml there is

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

I have also checked checked connection to virtual machine by writing 92.168.5.50:50030 to my web browser and I got Hadoop Map/Reduce administration as expected. So what is causeing that exception and how do I get rid of it?

Thank you for any ideas

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM