• Hadoop的单机模式


    具体的官网链接为:https://hadoop.apache.org/docs/r2.10.0/hadoop-project-dist/hadoop-common/SingleCluster.html

    官方Grep案例

    [root@iZbp1efx14jd8471u20gpaZ hadoop-2.7.2]# mkdir input
    [root@iZbp1efx14jd8471u20gpaZ hadoop-2.7.2]# cp etc/hadoop/*.xml input
    [root@iZbp1efx14jd8471u20gpaZ hadoop-2.7.2]# bin/hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-2.7.2.jar  grep input output 'dfs[a-z.]+'
    20/01/13 21:56:11 INFO Configuration.deprecation: session.id is deprecated. Instead, use dfs.metrics.session-id
    20/01/13 21:56:11 INFO jvm.JvmMetrics: Initializing JVM Metrics with processName=JobTracker, sessionId=
    20/01/13 21:56:12 INFO input.FileInputFormat: Total input paths to process : 8
    20/01/13 21:56:12 INFO mapreduce.JobSubmitter: number of splits:8
    20/01/13 21:56:12 INFO mapreduce.JobSubmitter: Submitting tokens for job: job_local1665352450_0001
    20/01/13 21:56:12 INFO mapreduce.Job: The url to track the job: http://localhost:8080/
    20/01/13 21:56:12 INFO mapreduce.Job: Running job: job_local1665352450_0001
    [root@iZbp1efx14jd8471u20gpaZ hadoop-2.7.2]# ll
    total 60
    drwxr-xr-x 2 root root  4096 May 22  2017 bin
    drwxr-xr-x 3 root root  4096 May 22  2017 etc
    drwxr-xr-x 2 root root  4096 May 22  2017 include
    drwxr-xr-x 2 root root  4096 Jan 13 21:55 input
    drwxr-xr-x 3 root root  4096 May 22  2017 lib
    drwxr-xr-x 2 root root  4096 May 22  2017 libexec
    -rw-r--r-- 1 root root 15429 May 22  2017 LICENSE.txt
    -rw-r--r-- 1 root root   101 May 22  2017 NOTICE.txt
    drwxr-xr-x 2 root root  4096 Jan 13 21:56 output
    -rw-r--r-- 1 root root  1366 May 22  2017 README.txt
    drwxr-xr-x 2 root root  4096 May 22  2017 sbin
    drwxr-xr-x 4 root root  4096 May 22  2017 share
    [root@iZbp1efx14jd8471u20gpaZ hadoop-2.7.2]# cd output/
    [root@iZbp1efx14jd8471u20gpaZ output]# ll
    total 4
    -rw-r--r-- 1 root root 11 Jan 13 21:56 part-r-00000
    -rw-r--r-- 1 root root  0 Jan 13 21:56 _SUCCESS
    [root@iZbp1efx14jd8471u20gpaZ output]# cat part-r-00000
    1       dfsadmin

    官方WordCount案例

    root@iZbp1efx14jd8471u20gpaZ hadoop-2.7.2]# mkdir wcinput
    [root@iZbp1efx14jd8471u20gpaZ hadoop-2.7.2]# cd wcinput
    [root@iZbp1efx14jd8471u20gpaZ wcinput]# touch wc.input
    [root@iZbp1efx14jd8471u20gpaZ wcinput]# vi wc.input
    [root@iZbp1efx14jd8471u20gpaZ wcinput]# cd ..
    [root@iZbp1efx14jd8471u20gpaZ hadoop-2.7.2]# ll
    total 64
    drwxr-xr-x 2 root root  4096 May 22  2017 bin
    drwxr-xr-x 3 root root  4096 May 22  2017 etc
    drwxr-xr-x 2 root root  4096 May 22  2017 include
    drwxr-xr-x 2 root root  4096 Jan 13 21:55 input
    drwxr-xr-x 3 root root  4096 May 22  2017 lib
    drwxr-xr-x 2 root root  4096 May 22  2017 libexec
    -rw-r--r-- 1 root root 15429 May 22  2017 LICENSE.txt
    -rw-r--r-- 1 root root   101 May 22  2017 NOTICE.txt
    drwxr-xr-x 2 root root  4096 Jan 13 21:56 output
    -rw-r--r-- 1 root root  1366 May 22  2017 README.txt
    drwxr-xr-x 2 root root  4096 May 22  2017 sbin
    drwxr-xr-x 4 root root  4096 May 22  2017 share
    drwxr-xr-x 2 root root  4096 Jan 13 22:30 wcinput
    [root@iZbp1efx14jd8471u20gpaZ hadoop-2.7.2]# hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-2.7.2.jar wordcount wcinput wcoutput
    20/01/13 22:30:43 INFO Configuration.deprecation: session.id is deprecated. Instead, use dfs.metrics.session-id
    20/01/13 22:30:43 INFO jvm.JvmMetrics: Initializing JVM Metrics with processName=JobTracker, sessionId=
    20/01/13 22:30:44 INFO input.FileInputFormat: Total input paths to process : 1
    20/01/13 22:30:44 INFO mapreduce.JobSubmitter: number of splits:1
    20/01/13 22:30:44 INFO mapreduce.JobSubmitter: Submitting tokens for job: job_local981224535_0001
    [root@iZbp1efx14jd8471u20gpaZ hadoop-2.7.2]# cat wcoutput/part-r-00000
    hadoop  2
    mapreduce       1
    topcheer        2
    yarn    1
    [root@iZbp1efx14jd8471u20gpaZ hadoop-2.7.2]# cat wcinput/wc.input
    bin/         include/     lib/         LICENSE.txt  output/      sbin/        wcinput/
    etc/         input/       libexec/     NOTICE.txt   README.txt   share/       wcoutput/
    [root@iZbp1efx14jd8471u20gpaZ hadoop-2.7.2]# cat wcinput/wc.input
    hadoop yarn
    hadoop mapreduce
    topcheer
    topcheer
    
    [root@iZbp1efx14jd8471u20gpaZ hadoop-2.7.2]#
  • 相关阅读:
    软工实践个人总结
    pyqt5设置背景图片出现问题
    第04组 Beta版本演示
    2020系统综合实践 期末大作业 04组
    2020系统综合实践 第7次实践作业 04组
    2020系统综合实践 第6次实践作业 04组
    2020系统综合实践 第5次实践作业
    2020系统综合实践 第4次实践作业
    2020系统综合实践 第3次实践作业
    2020系统综合实践 第2次实践作业
  • 原文地址:https://www.cnblogs.com/dalianpai/p/12189781.html
Copyright © 2020-2023  润新知