• 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]#
  • 相关阅读:
    Django框架 之 MTV模型、 基本命令、简单配置
    Django models模型ORM
    Django 链接数据库错误 Strick Mode 解决
    [BZOJ 2002] [HNOI2010]弹飞绵羊(Link Cut Tree)
    [BJOI2014]大融合(Link Cut Tree)
    [BZOJ1576] [BZOJ3694] [USACO2009Jan] 安全路径(最短路径+树链剖分)
    [Codeforces 1005F]Berland and the Shortest Paths(最短路树+dfs)
    CSP-S 2019游记
    浅谈高维前缀和
    [luogu 3175] [HAOI2015]按位或(min-max容斥+高维前缀和)
  • 原文地址:https://www.cnblogs.com/dalianpai/p/12189781.html
Copyright © 2020-2023  润新知