分享

自己编辑的MapReduce程序如何放在YARN上运营

rain1201 发表于 2015-7-10 19:01:08 [显示全部楼层] 回帖奖励 阅读模式 关闭右栏 1 9610
默认hadoop环境已搭建完全

1.打jar将自己的代码打jar包。例打成MyJob.jar,上传到hadoop安装目录下share/test/MyJob.jar
2.执行java类命令如下:
bin/hadoop jar share/test/MyJob.jar org.apache.hadoop.examples.WordCount /wanghongen/demo/filein/wordcount_in2.txt /wanghongen/demo/fileout/wordcount_out8
3.查看执行日志
[hadoop@Hadoop-Master hadoop]$ bin/hadoop jar share/test/MyJob.jar org.apache.hadoop.examples.WordCount /wanghongen/demo/filein/wordcount_in2.txt /wanghongen/demo/fileout/wordcount_out8
15/07/10 18:13:30 INFO client.RMProxy: Connecting to ResourceManager at Hadoop-Master/192.168.70.65:8032
15/07/10 18:13:30 INFO input.FileInputFormat: Total input paths to process : 1
15/07/10 18:13:30 INFO mapreduce.JobSubmitter: number of splits:1
15/07/10 18:13:31 INFO mapreduce.JobSubmitter: Submitting tokens for job: job_1430970937754_0003
15/07/10 18:13:31 INFO impl.YarnClientImpl: Submitted application application_1430970937754_0003
15/07/10 18:13:31 INFO mapreduce.Job: The url to track the job: http://Hadoop-Master:8088/proxy/application_1430970937754_0003/
15/07/10 18:13:31 INFO mapreduce.Job: Running job: job_1430970937754_0003
15/07/10 18:13:38 INFO mapreduce.Job: Job job_1430970937754_0003 running in uber mode : false
15/07/10 18:13:38 INFO mapreduce.Job:  map 0% reduce 0%
15/07/10 18:13:45 INFO mapreduce.Job:  map 100% reduce 0%
15/07/10 18:13:50 INFO mapreduce.Job:  map 100% reduce 100%
15/07/10 18:13:51 INFO mapreduce.Job: Job job_1430970937754_0003 completed successfully
15/07/10 18:13:51 INFO mapreduce.Job: Counters: 49
        File System Counters
                FILE: Number of bytes read=166
                FILE: Number of bytes written=194577
                FILE: Number of read operations=0
                FILE: Number of large read operations=0
                FILE: Number of write operations=0
                HDFS: Number of bytes read=235
                HDFS: Number of bytes written=116
                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)=5685
                Total time spent by all reduces in occupied slots (ms)=2976
                Total time spent by all map tasks (ms)=5685
                Total time spent by all reduce tasks (ms)=2976
                Total vcore-seconds taken by all map tasks=5685
                Total vcore-seconds taken by all reduce tasks=2976
                Total megabyte-seconds taken by all map tasks=5821440
                Total megabyte-seconds taken by all reduce tasks=3047424
        Map-Reduce Framework
                Map input records=8
                Map output records=15
                Map output bytes=175
                Map output materialized bytes=166
                Input split bytes=131
                Combine input records=15
                Combine output records=11
                Reduce input groups=11
                Reduce shuffle bytes=166
                Reduce input records=11
                Reduce output records=11
                Spilled Records=22
                Shuffled Maps =1
                Failed Shuffles=0
                Merged Map outputs=1
                GC time elapsed (ms)=37
                CPU time spent (ms)=1920
                Physical memory (bytes) snapshot=365965312
                Virtual memory (bytes) snapshot=1686417408
                Total committed heap usage (bytes)=215941120
        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=104
        File Output Format Counters
                Bytes Written=116


4.查看执行结果
[hadoop@Hadoop-Master hadoop]$ bin/hadoop fs -cat /wanghongen/demo/fileout/wordcount_out8/part-r-00000
c        1
c++        2
hadoop        2
hbase        1
helloworld        1
java        3
javascript        1
mapreduce        1
python        1





已有(1)人评论

跳转到指定楼层
Alkaloid0515 发表于 2015-7-11 16:41:03
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

推荐上一条 /2 下一条