在Eclipse中运行hadoop程序

1、下载hadoop-eclipse-plugin-1.2.1.jar,并将之复制到eclipse/plugins下。

2、打开map-reduce视图

在eclipse中,打开window——>open perspetive——>other,选择map/reduce。

3、选择Map/Reduce Locations标签页,新建一个Location

4、在project exploer中,可以浏览刚才定义站点的文件系统

5、准备测试数据,并上传到hdfs中。

liaoliuqingdeMacBook-Air:Downloads liaoliuqing$ hadoop fs -mkdir in

liaoliuqingdeMacBook-Air:Downloads liaoliuqing$ hadoop fs -copyFromLocal maxTemp.txt in

liaoliuqingdeMacBook-Air:Downloads liaoliuqing$ hadoop fs -ls in

Found 1 items

-rw-r--r--   1 liaoliuqing supergroup        953 2014-12-14 09:47 /user/liaoliuqing/in/maxTemp.txt

其中maxTemp.txt的内容如下:

123456798676231190101234567986762311901012345679867623119010123456798676231190101234561+00121534567890356

123456798676231190101234567986762311901012345679867623119010123456798676231190101234562+01122934567890456

123456798676231190201234567986762311901012345679867623119010123456798676231190101234562+02120234567893456

123456798676231190401234567986762311901012345679867623119010123456798676231190101234561+00321234567803456

123456798676231190101234567986762311902012345679867623119010123456798676231190101234561+00429234567903456

123456798676231190501234567986762311902012345679867623119010123456798676231190101234561+01021134568903456

123456798676231190201234567986762311902012345679867623119010123456798676231190101234561+01124234578903456

123456798676231190301234567986762311905012345679867623119010123456798676231190101234561+04121234678903456

123456798676231190301234567986762311905012345679867623119010123456798676231190101234561+00821235678903456

6、准备map-reduce程序

程序请见http://blog.csdn.net/jediael_lu/article/details/37596469

7、运行程序

MaxTemperature.java——>run as——>run configuration

在arguments中填入输入及输出文档,开始run。

8、以下是eclise console中的输出内容

14/12/14 10:52:05 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable

14/12/14 10:52:05 WARN mapred.JobClient: Use GenericOptionsParser for parsing the arguments. Applications should implement Tool for the same.

14/12/14 10:52:05 WARN mapred.JobClient: No job jar file set.  User classes may not be found. See JobConf(Class) or JobConf#setJar(String).

14/12/14 10:52:05 INFO input.FileInputFormat: Total input paths to process : 1

14/12/14 10:52:05 WARN snappy.LoadSnappy: Snappy native library not loaded

14/12/14 10:52:06 INFO mapred.JobClient: Running job: job_local1815770300_0001

14/12/14 10:52:06 INFO mapred.LocalJobRunner: Waiting for map tasks

14/12/14 10:52:06 INFO mapred.LocalJobRunner: Starting task: attempt_local1815770300_0001_m_000000_0

14/12/14 10:52:06 INFO mapred.Task:  Using ResourceCalculatorPlugin : null

14/12/14 10:52:06 INFO mapred.MapTask: Processing split: hdfs://localhost:9000/user/liaoliuqing/in/maxTemp.txt:0+953

14/12/14 10:52:06 INFO mapred.MapTask: io.sort.mb = 100

14/12/14 10:52:06 INFO mapred.MapTask: data buffer = 79691776/99614720

14/12/14 10:52:06 INFO mapred.MapTask: record buffer = 262144/327680

14/12/14 10:52:06 INFO mapred.MapTask: Starting flush of map output

14/12/14 10:52:06 INFO mapred.MapTask: Finished spill 0

14/12/14 10:52:06 INFO mapred.Task: Task:attempt_local1815770300_0001_m_000000_0 is done. And is in the process of commiting

14/12/14 10:52:06 INFO mapred.LocalJobRunner:

14/12/14 10:52:06 INFO mapred.Task: Task ‘attempt_local1815770300_0001_m_000000_0‘ done.

14/12/14 10:52:06 INFO mapred.LocalJobRunner: Finishing task: attempt_local1815770300_0001_m_000000_0

14/12/14 10:52:06 INFO mapred.LocalJobRunner: Map task executor complete.

14/12/14 10:52:06 INFO mapred.Task:  Using ResourceCalculatorPlugin : null

14/12/14 10:52:06 INFO mapred.LocalJobRunner:

14/12/14 10:52:06 INFO mapred.Merger: Merging 1 sorted segments

14/12/14 10:52:06 INFO mapred.Merger: Down to the last merge-pass, with 1 segments left of total size: 90 bytes

14/12/14 10:52:06 INFO mapred.LocalJobRunner:

14/12/14 10:52:06 INFO mapred.Task: Task:attempt_local1815770300_0001_r_000000_0 is done. And is in the process of commiting

14/12/14 10:52:06 INFO mapred.LocalJobRunner:

14/12/14 10:52:06 INFO mapred.Task: Task attempt_local1815770300_0001_r_000000_0 is allowed to commit now

14/12/14 10:52:06 INFO output.FileOutputCommitter: Saved output of task ‘attempt_local1815770300_0001_r_000000_0‘ to hdfs://localhost:9000/user/liaoliuqing/out

14/12/14 10:52:06 INFO mapred.LocalJobRunner: reduce > reduce

14/12/14 10:52:06 INFO mapred.Task: Task ‘attempt_local1815770300_0001_r_000000_0‘ done.

14/12/14 10:52:07 INFO mapred.JobClient:  map 100% reduce 100%

14/12/14 10:52:07 INFO mapred.JobClient: Job complete: job_local1815770300_0001

14/12/14 10:52:07 INFO mapred.JobClient: Counters: 19

14/12/14 10:52:07 INFO mapred.JobClient:   File Output Format Counters

14/12/14 10:52:07 INFO mapred.JobClient:     Bytes Written=43

14/12/14 10:52:07 INFO mapred.JobClient:   File Input Format Counters

14/12/14 10:52:07 INFO mapred.JobClient:     Bytes Read=953

14/12/14 10:52:07 INFO mapred.JobClient:   FileSystemCounters

14/12/14 10:52:07 INFO mapred.JobClient:     FILE_BYTES_READ=450

14/12/14 10:52:07 INFO mapred.JobClient:     HDFS_BYTES_READ=1906

14/12/14 10:52:07 INFO mapred.JobClient:     FILE_BYTES_WRITTEN=135618

14/12/14 10:52:07 INFO mapred.JobClient:     HDFS_BYTES_WRITTEN=43

14/12/14 10:52:07 INFO mapred.JobClient:   Map-Reduce Framework

14/12/14 10:52:07 INFO mapred.JobClient:     Reduce input groups=5

14/12/14 10:52:07 INFO mapred.JobClient:     Map output materialized bytes=94

14/12/14 10:52:07 INFO mapred.JobClient:     Combine output records=0

14/12/14 10:52:07 INFO mapred.JobClient:     Map input records=9

14/12/14 10:52:07 INFO mapred.JobClient:     Reduce shuffle bytes=0

14/12/14 10:52:07 INFO mapred.JobClient:     Reduce output records=5

14/12/14 10:52:07 INFO mapred.JobClient:     Spilled Records=16

14/12/14 10:52:07 INFO mapred.JobClient:     Map output bytes=72

14/12/14 10:52:07 INFO mapred.JobClient:     Total committed heap usage (bytes)=329252864

14/12/14 10:52:07 INFO mapred.JobClient:     SPLIT_RAW_BYTES=118

14/12/14 10:52:07 INFO mapred.JobClient:     Map output records=8

14/12/14 10:52:07 INFO mapred.JobClient:     Combine input records=0

14/12/14 10:52:07 INFO mapred.JobClient:     Reduce input records=8

时间: 2024-10-22 14:47:16

在Eclipse中运行hadoop程序的相关文章

【爬坑】在 IDEA 中运行 Hadoop 程序 报 winutils.exe 不存在错误解决方案

0. 问题说明 环境为 Windows 10 在 IDEA 中运行 Hadoop 程序报   winutils.exe 不存在  错误 1. 解决方案 [1.1 解压] 解压 hadoop-2.7.3.zip 文件到自定义目录 [1.2 配置 Hadoop 环境变量] 新建HADOOP_HOME,变量值为D:\program\hadoop-2.7.3 添加PATH,添加%HADOOP_HOME%\bin;%HADOOP_HOME%\sbin [1.3 重启 IDEA] [ 1.4 测试配置 ]

在Eclipse中运行、配置Hadoop

版权所有: [email protected]  严禁转载! 1.安装插件 准备程序: eclipse-3.3.2(这个版本的插件只能用这个版本的eclipse) hadoop-0.20.2-eclipse-plugin.jar (在hadoop-0.20.2/contrib/eclipse-plugin目录下) 将hadoop-0.20.2-eclipse-plugin.jar 复制到eclipse/plugins目录下,重启eclipse. 2.打开MapReduce视图 Window ->

JAVA 基础 / 第四课:在ECLIPSE中运行第一个 JAVA 程序以及找不到类的问题

2018-03-06 在Eclipse中运行java 程序 步骤 1 : 打开java文件 直接打开在 命令行Hello World 中创建的java 文件:HelloWorld.java 步骤 2 : 运行 点击绿色运行按钮,直接运行 在eclipse中,编译过程自动执行了 步骤 3 : 观察运行结果 一旦运行成功,会在下方出现控制台console界面 如果找不到控制台console窗口,使用如下步骤打开控制台窗口 步骤 4 : 打开控制台窗口 在默认情况下,console窗口是打开的,倘若无

HelloWorld系列(五)- 在Eclipse中运行第一个 java 程序

在Eclipse中运行java 程序 步骤1:打开java文件步骤2:运行步骤3:观察运行结果步骤4:打开控制台窗口步骤5:练习-在eclipse中运行JAVA程序步骤6:答案-在eclipse中运行JAVA程序 步骤 1 : 打开java文件 直接打开在 命令行Hello World 中创建的java 文件 HelloWorld.java 步骤 2 : 运行 点击绿色运行按钮,直接运行 在eclipse中,编译过程自动执行了 步骤 3 : 观察运行结果 一旦运行成功,会在下方出现控制台cons

使用Eclipse编译运行MapReduce程序 Hadoop2.6.0_Ubuntu/CentOS

文章来源:http://www.powerxing.com/hadoop-build-project-using-eclipse/ 使用Eclipse编译运行MapReduce程序 Hadoop2.6.0_Ubuntu/CentOS 本教程介绍的是如何在 Ubuntu/CentOS 中使用 Eclipse 来开发 MapReduce 程序,在 Hadoop 2.6.0 下验证通过.虽然我们可以使用命令行编译打包运行自己的MapReduce程序,但毕竟编写代码不方便.使用 Eclipse,我们可以

Win系统下用Eclipse中运行远程hadoop MapReduce程序常见错误及解决方法

一.Permission denied 1.Win系统下用Eclipse中运行远程hadoop MapReduce程序出现报错 org.apache.hadoop.security.AccessControlException: org.apache.hadoop.security.AccessControlException: Permission denied: user=xxx, access=WRITE, inode="xxx":xxx:supergroup:rwxr-xr-x

Win7下Eclipse中运行远程MapReduce程序

1.hadoop插件的参数配置 2.运行时的参数 3.运行结果 Win7下Eclipse中运行远程MapReduce程序,布布扣,bubuko.com

Hadoop3 在eclipse中访问hadoop并运行WordCount实例

前言:       毕业两年了,之前的工作一直没有接触过大数据的东西,对hadoop等比较陌生,所以最近开始学习了.对于我这样第一次学的人,过程还是充满了很多疑惑和不解的,不过我采取的策略是还是先让环境跑起来,然后在能用的基础上在多想想为什么.       通过这三个礼拜(基本上就是周六周日,其他时间都在加班啊T T)的探索,我目前主要完成的是: 1.在Linux环境中伪分布式部署hadoop(SSH免登陆),运行WordCount实例成功. http://www.cnblogs.com/Pur

在linux下安装eclipse以及运行c++程序的安装步骤

1.       下载jre,eclipse,cdt 其中jre是java运行环境,eclipse需要先装jre,才可能运行,cdt是在eclipse中运行c\c++程序的插件. 下载jre 网址是:http://www.oracle.com/technetwork/java/javase/downloads/index.html,点击JRE下载(如下图) 选择"Aceept License Argeement" (如上图) 点击"jre-7u21-linux-i586.bi