eclipse debug调试mapreduce程序 – 蓝狐乐队的个人空间 – 开源中国社区

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

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<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

?
1
2
3
4
5
6
7
 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");

来源URL:http://my.oschina.net/u/1169079/blog/335548