1. Create the file example.txt and copy it to /user/root of hdfs
./hadoop fs -put /root/example.txt /user/root
2、执行hadoop-mapreduce-examples-2.8.0.jar
./hadoop jar ../share/hadoop/mapreduce/hadoop-mapreduce-examples-2.8.0.jar wordcount /user/root/example.txt /output
3. According to the configuration of building a cluster /opt/hadoop-2.8.0/etc/hadoop/mapred-site.xml, wordcunt will be stuck in INFO mapreduce.Job: map 0% reduce 0%
<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
</property
According to the above configuration, yarn is used for calculation, then nodemanager must be started,
If you do not use yarn and configure mapreduce.job.tracker, you can also use MRv2 to execute the job, so you don't need to start nodemanager:
<property>
<name>mapreduce.job.tracker</name>
<value>hdfs://hserver2:8001</value>
<final>true</final>
<property>
After modification, re-run wordcunt
4. Check the output statistics
./hadoop fs -cat /output/part-r-00000
At this point, the wordcunt test is completed.