提交官方MapReduce作业到YARN

环境

Hadoop使用版本:hadoop-2.6.0-cdh5.15.1

使用官方提供的例子 PI

hadoop-2.6.0-cdh5.15.1/share/hadoop/mapreduce路径下有一个hadoop-mapreduce-examples-2.6.0-cdh5.15.1.jar文件
运行命令:hadoop jar hadoop-mapreduce-examples-2.6.0-cdh5.15.1.jar pi 2 3
然后在浏览器中输入yarn的地址:ip:8088,在RUNNING下可以看到运行的作业:
在这里插入图片描述
查看控制台输出:

iie4bu@swarm-worker1:~/app/hadoop-2.6.0-cdh5.15.1/share/hadoop/mapreduce$ hadoop jar hadoop-mapreduce-examples-2.6.0-cdh5.15.1.jar pi 2 3
Number of Maps  = 2
Samples per Map = 3
19/11/07 15:52:37 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Wrote input for Map #0
Wrote input for Map #1
Starting Job
19/11/07 15:52:38 INFO client.RMProxy: Connecting to ResourceManager at /0.0.0.0:8032
19/11/07 15:52:39 INFO input.FileInputFormat: Total input paths to process : 2
19/11/07 15:52:39 INFO mapreduce.JobSubmitter: number of splits:2
19/11/07 15:52:39 INFO mapreduce.JobSubmitter: Submitting tokens for job: job_1573113153178_0001
19/11/07 15:52:40 INFO impl.YarnClientImpl: Submitted application application_1573113153178_0001
19/11/07 15:52:40 INFO mapreduce.Job: The url to track the job: http://swarm-worker1:8088/proxy/application_1573113153178_0001/
19/11/07 15:52:40 INFO mapreduce.Job: Running job: job_1573113153178_0001
19/11/07 15:52:48 INFO mapreduce.Job: Job job_1573113153178_0001 running in uber mode : false
19/11/07 15:52:48 INFO mapreduce.Job:  map 0% reduce 0%
19/11/07 15:52:54 INFO mapreduce.Job:  map 50% reduce 0%
19/11/07 15:52:55 INFO mapreduce.Job:  map 100% reduce 0%
19/11/07 15:53:00 INFO mapreduce.Job:  map 100% reduce 100%
19/11/07 15:53:00 INFO mapreduce.Job: Job job_1573113153178_0001 completed successfully
19/11/07 15:53:00 INFO mapreduce.Job: Counters: 49
	File System Counters
		FILE: Number of bytes read=50
		FILE: Number of bytes written=430365
		FILE: Number of read operations=0
		FILE: Number of large read operations=0
		FILE: Number of write operations=0
		HDFS: Number of bytes read=540
		HDFS: Number of bytes written=215
		HDFS: Number of read operations=11
		HDFS: Number of large read operations=0
		HDFS: Number of write operations=3
	Job Counters 
		Launched map tasks=2
		Launched reduce tasks=1
		Data-local map tasks=2
		Total time spent by all maps in occupied slots (ms)=6933
		Total time spent by all reduces in occupied slots (ms)=3732
		Total time spent by all map tasks (ms)=6933
		Total time spent by all reduce tasks (ms)=3732
		Total vcore-milliseconds taken by all map tasks=6933
		Total vcore-milliseconds taken by all reduce tasks=3732
		Total megabyte-milliseconds taken by all map tasks=7099392
		Total megabyte-milliseconds taken by all reduce tasks=3821568
	Map-Reduce Framework
		Map input records=2
		Map output records=4
		Map output bytes=36
		Map output materialized bytes=56
		Input split bytes=304
		Combine input records=0
		Combine output records=0
		Reduce input groups=2
		Reduce shuffle bytes=56
		Reduce input records=4
		Reduce output records=0
		Spilled Records=8
		Shuffled Maps =2
		Failed Shuffles=0
		Merged Map outputs=2
		GC time elapsed (ms)=308
		CPU time spent (ms)=2610
		Physical memory (bytes) snapshot=942092288
		Virtual memory (bytes) snapshot=7986814976
		Total committed heap usage (bytes)=1810890752
	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=236
	File Output Format Counters 
		Bytes Written=97
Job Finished in 21.985 seconds
Estimated value of Pi is 4.00000000000000000000

刚开始会执行Connecting to ResourceManager at /0.0.0.0:8032,首先连接到ResourceManager中。这就是一个最简单的YARN作业

使用官方提供的例子 wordcount

在与上面同样的路径下执行命令:
iie4bu@swarm-worker1:~/app/hadoop-2.6.0-cdh5.15.1/share/hadoop/mapreduce$ hadoop jar hadoop-mapreduce-examples-2.6.0-cdh5.15.1.jar wordcount /wc/input/test.txt /wc/output
在这里插入图片描述
在/wc/output/下可以看到输出结果的文件:

iie4bu@swarm-worker1:~/app/hadoop-2.6.0-cdh5.15.1/share/hadoop/mapreduce$ hadoop fs -text /wc/output/part-r-00000
19/11/07 16:26:34 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Hello	1
haha	2
hello	3
meme	1
welcome	2
world	1
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值