问答文章1 问答文章501 问答文章1001 问答文章1501 问答文章2001 问答文章2501 问答文章3001 问答文章3501 问答文章4001 问答文章4501 问答文章5001 问答文章5501 问答文章6001 问答文章6501 问答文章7001 问答文章7501 问答文章8001 问答文章8501 问答文章9001 问答文章9501

eclipse 如何在一个普通的java project里运行hadoop M/R(而不建Map/Reduce project)

发布网友 发布时间:2022-05-16 20:23

我来回答

1个回答

热心网友 时间:2024-03-01 16:27

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

2、打开map-rece视图
在eclipse中,打开window——>open perspetive——>other,选择map/rece。

3、选择Map/Rece 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-rece程序
程序请见http://blog.csdn.net/jediael_lu/article/details/37596469

7、运行程序
MaxTemperature.Java——>run as——>run configuration
在arguments中填入输入及输出目录,开始run。

此处是在hdfs中运行程序,事实上也可以在本地文件系统中运行程序,此方法可以方便的用于程序调试。
如在参数中填入:

/Users/liaoliuqing/in /Users/liaoliuqing/out
即可。

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: rece > rece
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% rece 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-Rece Framework
14/12/14 10:52:07 INFO mapred.JobClient: Rece 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: Rece shuffle bytes=0
14/12/14 10:52:07 INFO mapred.JobClient: Rece 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: Rece input records=8追问都说了已经在maprece project下测试成功,你这明显是照抄来的

声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com
win7窗口淡入淡出慢 iPhone 小技巧:如何将 Safari 浏览器中的网页添加到桌面? 锰粉是什么颜色的金属 铁精粉的常见颜色是什么 烟花爆竹中的金属粉末如何使其呈现绚丽色彩? 金粉有哪些种类 灰土每层回填最大厚度 灰土基础简史 如何让一个喜欢你的女孩讨厌你! 西环里新区基本资料 hadoop WordCount报ClassNotFoundException: cn.itcast.hadoop.mapreduce.WordCount$TokenizerMapper异常 练市烧麦面食店怎么样 java.lang.RuntimeException: Error in configuring object 呼市稍麦店一个月电费多少钱? 昕麦迪稍麦店怎么样 java 怎么使用snappy 稍麦店开业求一副对联 什么花可以当菜吃? 雅培血糖仪的传感器如果开了开胶了以后怎么办? 柜子三合板开胶了怎么办 本子开胶了怎么办?热熔胶可以吗?怎么用啊? 手机屏幕开胶,手机是不是假货啊 耐克鞋开胶了给换吗? 我vivo手机脱胶了有点严重快脱一半了影响使用吗有没有危险我去店里问了下修的家格合买新的没区别? 我的惠普显示器开胶了是正面屏幕和外壳连接的地方是大面积的开胶。四面都有不同程度的缝隙。怎么办啊 JAVA图形界面为什么现在很少有人用 如何在java图形化界面动态显示当前时间 java图形界面的布局 用java图形化界面 java实现实现对xml的添加删除 dom JAVA图形化 好的生日创意有什么?很急的!!! 申请国家专利查新范围是什么 沫晗依美是什么意思 有什么比较好的生日祝福短信推荐? 怎样写出最好的生日祝福语? 雅乐士油漆好吗? 工人在工地受伤怎么赔偿 华东理工大学的学术研究 石油化工工程施工企业资质为什么是住建部发 读完真心英雄你有什么感想300字作文 工人在工地受伤怎样索赔 以我的什么感受为题的作文300字 水平仪水平线没光是什问题 聚创之光水平仪是什么品牌? 迪兰rx580战神后面有几个插口是干嘛的 淘宝买的迪兰rx580 4g 为啥后边只有一个dp接口和一个hdmi接口,还有一个itv接口! 水平仪怎样校对检查 华硕ROG STRIX RX580显卡都有那些视频输出接口? 海尔立式全自动小神童XQB60-Z918LM洗衣机好不好能不能洗干净? X53K立式铣床主轴怎么选择合适?