windows下开发mapreduce程序,打包在linux hadoop集群执行过程

假设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 platform... 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 ~]$ 
  • 0
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

历史五千年

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值