mapreduce run eclipse of wordcount

1, eclipse plug-ins installed hadoop

Plug Download: Link: https://pan.baidu.com/s/1U4_6kLFNiKeLsGfO7ahXew extraction code: as9e 

Download hadoop-eclipse-plugin-2.7.3.jar package, into the path of the eclipse (eclipse version I eclipse mars, the path is C: \ Users \ Administrator \ .p2 \ pool \ plugins, other versions can be placed directly into eclipse mounting the plugin path)

2, the local hadoop installation and configuration environment variables

HADOOP_HOME:C:\hadoop-2.7.2
PATH后面追加%HADOOP_HOME%\bin;%HADOOP_HOME%\sbin;

  

 3, modify the configuration file hadoop hadoop-2.7.2 \ etc \ hadoop \ hadoop-env.cmd (JAVA_HOME space causes an error in the path, where it is treated separately)

set JAVA_HOME="C:\Program Files"\Java\jdk1.8.0_45

4, the configuration of the eclipse path hadoop

5, window-show views-other-Map / Reduce location, open the window mapreduce

6, click on the right side of the elephant, big data configuration server address in the window, if the host has been configured ip domain mapping can be used directly, or fill in a cluster ip address

 

 

 

 7, the left side of the window that appears cluster connection information, directory should be the same as when accessing directly into your browser.

8, right, the new project mapreduce wordcount

9,将源码中wordcount.java类复制到项目中,代码路径hadoop-2.7.7-src\hadoop-mapreduce-project\hadoop-mapreduce-client\hadoop-mapreduce-client-jobclient\src\test\java\org\apache\hadoop\mapred

源码下载地址:链接: https://pan.baidu.com/s/1yRRymdG2hyhbv-PJjj_21w 提取码: 7chz 

10,将log4j.properties文件放入项目src下,文件路径hadoop-2.7.7-src\hadoop-common-project\hadoop-common\src\test\resources

11,在集群创建输入文件夹,并修改权限

hadoop fs -mkdir /hadoopTest
hadoop fs -chmod -R 777 /hadoopTest

 

12,右键点击hadoopTest,创建input文件夹,注意不要创建output文件夹,若有页需要删除,因为执行程序会自动创建此文件夹

13,右键上传文件,将需要统计的文本,上传到input目录

14,右键wordcount项目,点击run configuration,配置执行执行参数

15,点击apply,再点击run按钮,执行程序,再查看dfs locations,发现多了output目录,下面有程序执行结果

16,如果程序执行报错:org.apache.hadoop.io.nativeio.NativeIO$Windwos.access0需要从源码中copy出NativeIO类,放入项目中,修改access方法,改为return0。注意,必须从源码中得到,从jar中得到的类是没有此方法的

 

Guess you like

Origin www.cnblogs.com/javadongx/p/hadoop_mapredue_wordcount_eclipse.html