设为首页 加入收藏

TOP

windows下开发mapreduce程序,打包在linux hadoop集群执行过程
2018-12-07 00:21:14 】 浏览:133
Tags:windows 开发 mapreduce 程序 打包 linux hadoop 集群 执行 过程
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/wo198711203217/article/details/80523326

假设mapreduce程序已经写好,主类名称是com.wc.WordCount
下面开始演示。
1、右键项目,点击export
这里写图片描述
2、在export界面选择java jar
这里写图片描述
3、输入文件名,点击finish
这里写图片描述
4、上传到hadoop集群namenode节点上
5、使用hadoop jar命令进行执行
命令格式:hadoop jar jarFileName mainClass arg1 arg2 …
注意:这里的mainClass指的是主类名称(就是定义job的类),主类名称必须包含包名。

[hadoop@hadoop2 ~]$ hadoop jar wordcount.jar com.wc.WordCount
18/05/31 21:54:13 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platf
		    

orm... using builtin-java classes where applicable 18/05/31 21:54:14 INFO client.ConfiguredRMFailoverProxyProvider: Failing over to rm2 18/05/31 21:54:15 WARN mapreduce.JobResourceUploader: Hadoop command-line option parsing not performed. Implement the Tool interface and execute your application with ToolRunner to remedy this. 18/05/31 21:54:15 INFO input.FileInputFormat: Total input paths to process : 1 18/05/31 21:54:16 INFO mapreduce.JobSubmitter: number of splits:1 18/05/31 21:54:16 INFO mapreduce.JobSubmitter: Submitting tokens for job: job_1527764706402_0001 18/05/31 21:54:17 INFO impl.YarnClientImpl: Submitted application application_1527764706402_0001 18/05/31 21:54:17 INFO mapreduce.Job: The url to track the job: http://hadoop4:8088/proxy/application_1527764706402_0001/ 18/05/31 21:54:17 INFO mapreduce.Job: Running job: job_1527764706402_0001 18/05/31 21:54:41 INFO mapreduce.Job: Job job_1527764706402_0001 running in uber mode : false 18/05/31 21:54:41 INFO mapreduce.Job: map 0% reduce 0% 18/05/31 21:55:07 INFO mapreduce.Job: map 100% reduce 0% 18/05/31 21:55:34 INFO mapreduce.Job: map 100% reduce 100% 18/05/31 21:55:36 INFO mapreduce.Job: Job job_1527764706402_0001 completed successfully 18/05/31 21:55:36 INFO mapreduce.Job: Counters: 49 File System Counters FILE: Number of bytes read=313 FILE: Number of bytes written=220453 FILE: Number of read operations=0 FILE: Number of large read operations=0 FILE: Number of write operations=0 HDFS: Number of bytes read=274 HDFS: Number of bytes written=124 HDFS: Number of read operations=6 HDFS: Number of large read operations=0 HDFS: Number of write operations=2 Job Counters Launched map tasks=1 Launched reduce tasks=1 Data-local map tasks=1 Total time spent by all maps in occupied slots (ms)=32131 Total time spent by all reduces in occupied slots (ms)=13208 Total time spent by all map tasks (ms)=32131 Total time spent by all reduce tasks (ms)=13208 Total vcore-milliseconds taken by all map tasks=32131 Total vcore-milliseconds taken by all reduce tasks=13208 Total megabyte-milliseconds taken by all map tasks=32902144 Total megabyte-milliseconds taken by all reduce tasks=13524992 Map-Reduce Framework Map input records=12 Map output records=24 Map output bytes=259 Map output materialized bytes=313 Input split bytes=111 Combine input records=0 Combine output records=0 Reduce input groups=13 Reduce shuffle bytes=313 Reduce input records=24 Reduce output records=13 Spilled Records=48 Shuffled Maps =1 Failed Shuffles=0 Merged Map outputs=1 GC time elapsed (ms)=214 CPU time spent (ms)=2330 Physical memory (bytes) snapshot=261709824 Virtual memory (bytes) snapshot=4126769152 Total committed heap usage (bytes)=134053888 Shuffle Errors BAD_ID=0 CONNECTION=0 IO_ERROR=0 WRONG_LENGTH=0 WRONG_MAP=0 WRONG_REDUCE=0 File Input Format Counters Bytes Read=163 File Output Format Counters Bytes Written=124 [hadoop@hadoop2 ~]$

6、查看执行结果

[hadoop@hadoop2 ~]$ hadoop fs -cat /wordcount/output/part-r-00000
18/05/31 22:00:16 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
abc     1
datanode        1
good    1
hadoop  1
hdfs    1
hello   12
mysql   1
namenode        1
nodemanager     1
oracle  1
resourcemanager 1
world   1
yarn    1
[hadoop@hadoop2 ~]$ 

编程开发网
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇hadoop fs   常用的shell命.. 下一篇hadoop完全分布式搭建

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容:

array(4) { ["type"]=> int(8) ["message"]=> string(24) "Undefined variable: jobs" ["file"]=> string(32) "/mnt/wp/cppentry/do/bencandy.php" ["line"]=> int(217) }