eclipse debug调试mapreduce程序

1、将mapred-site.xml文件拷贝一份到项目中

<configuration>
    <property>
        <name>mapreduce.framework.name</name>
            <value>yarn</value>
    </property>
    <property> 
        <name>mapred.child.java.opts</name> 
        <value>-Xmx800m -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000</value> 
    </property>
    <property>
    <name>mapreduce.jobtracker.staging.root.dir</name>
    <value>/tmp</value>
  </property>
   <property>
    <name>yarn.app.mapreduce.am.staging-dir</name>
    <value>/tmp</value>
  </property>
  <property>
    <name>mapreduce.framework.name</name>
    <value>local</value>
  </property>
  <property>
    <name>mapreduce.jobtracker.address</name>
    <value>local</value>
  </property>
<property>
<name>mapred.job.tracker</name>
<value>local</value>
</property>
</configuration>

2、在项目中加入本地mapred-site.xml配置,从本地项目中读取配置文件运行,在reduce中debug

 Job job = new Job(conf, "word count");
     conf.addResource("classpath:/Hadoop01/mapred-site.xml");
     conf.set("fs.defaultFS", "hdfs://192.168.1.10:9008");
     conf.set("mapreduce.framework.name", "yarn");
     conf.set("yarn.resourcemanager.address", "192.168.1.10:8032");
     conf.set("mapred.remote.os", "Linux");
     conf.set("hadoop.job.ugi", "hadoop,hadoop");

你可能感兴趣的:(eclipse debug调试mapreduce程序)