自己写的java程序如何放在YARN环境下运行

来源:互联网 发布:惠喵 知乎百度知道 编辑:程序博客网 时间:2024/05/16 09:41
1.打包自己的java程序jar包,放在hadoop安装目录下share/test/MyJob.jar
2.执行hadoop命令如下:
[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

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
0 0
原创粉丝点击