简体   繁体   中英

Hadoop - Connect to JobTracker

I am new to hadoop and I trying to understand if it is possible to connect to either remote or local jobtracker, I need this because I want identify the task that Hadoop is currently executing, I am trying this sample I found:

public class MyTracker {

    MyTracker(){
        try{
            inetAddress = new InetSocketAddress(InetAddress.getByName("localhost"), 50030);
        }
        catch(Exception e){
            e.printStackTrace();
        }
    }

    InetSocketAddress inetAddress = null;

    public static void main(String[] args) {

        MyTracker myTracker = new MyTracker();
        myTracker.createJobTracker();
    }

    public void createJobTracker(){

        Configuration conf = new Configuration();

        try {
            JobClient jobClient = new JobClient(inetAddress, conf);
            JobStatus[] activeJobs = jobClient.jobsToComplete();

            for(int i = 0 ; i < activeJobs.length; i++){
                System.out.println(activeJobs[i]);
            }
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
}

When I run this code I got this error:

java.io.IOException: Call to localhost/127.0.0.1:50030 failed on local exception: java.io.EOFException
at org.apache.hadoop.ipc.Client.wrapException(Client.java:775)
at org.apache.hadoop.ipc.Client.call(Client.java:743)
at org.apache.hadoop.ipc.RPC$Invoker.invoke(RPC.java:220)
at org.apache.hadoop.mapred.$Proxy0.getProtocolVersion(Unknown Source)

Please, help me understand what I am missing.

I was able to run it and it indeed had a version missmatch plus this

Jobtracker API error - Call to localhost/127.0.0.1:50030 failed on local exception: java.io.EOFException

because I was trying to connect to port 50030 when I should connect to port 9001 as described in that thread.

thanks

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