1. Copy the Mapred-site.xml file to the project
<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. Add a local mapred-site.xml configuration to the project, read the configuration file from the local project, and debug in reduce
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 Debug MapReduce Program