我的大数据之旅-Hadoop启动YARN并运行MapReduce-WordCount

目标

(1)配置集群在YARN上运行MR

(2)启动、测试集群

(3)在YARN上运行WordCount案例


执行步骤

(1)配置集群

(a)配置yarn-env.sh

$ vim etc/hadoop/yarn-env.sh

我的大数据之旅-Hadoop启动YARN并运行MapReduce-WordCount_第1张图片

(b)配置etc/hadoop/mapred-site.xml(对mapred-site.xml.template重新命名为mapred-site.xml)

[fengling@hadoop129 hadoop-2.7.2]$ mv etc/hadoop/mapred-site.xml.template etc/hadoop/mapred-site.xml

    
    
        mapreduce.framework.name
        yarn
    

(c) 配置etc/hadoop/yarn-site.xml




        
        
                yarn.nodemanager.aux-services
                mapreduce_shuffle
        

        
        
                yarn.resourcemanager.hostname
                hadoop101
        


(2)启动yarn

[fengling@hadoop129 hadoop-2.7.2]$  sbin/start-yarn.sh
[fengling@hadoop129 hadoop-2.7.2]$ jps
30384 ResourceManager
30518 NodeManager
114859 SecondaryNameNode
114170 DataNode
113999 NameNode
30766 Jps

启动成功,浏览器访问 http://hadoop129:8088 即可查看web管理界面

我的大数据之旅-Hadoop启动YARN并运行MapReduce-WordCount_第2张图片

(3)在YARN上运行WordCount案例

[fengling@hadoop129 hadoop-2.7.2]$ bin/hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-2.7.2.jar wordcount /user/fengling/input/hadoop/ wc_output_20190925

页面查看运行结果

我的大数据之旅-Hadoop启动YARN并运行MapReduce-WordCount_第3张图片

查看统计结果

[fengling@hadoop129 hadoop-2.7.2]$ bin/hdfs dfs -cat wc_output_20190925/*

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

你可能感兴趣的:(Hadoop,大数据,Hadoop,WordCount)