第四章 Hadoop本地运行模式

一、Hadoop官网

Hadoop官方网站:http://hadoop.apache.org/

二、Hadoop运行模式

Hadoop运行模式包括:本地模式、伪分布式模式以及完全分布式模式。

#1.本地模式:单机运行,只是用来演示一下官方案例。生产环境不用。
#2.伪分布式模式:也是单机运行,但是具备Hadoop集群的所有功能,一台服务器模拟一个分布式的环境。个别缺钱的公司用来测试,生产环境不用。
#3.完全分布式模式:多台服务器组成分布式环境,生产环境使用。

三、Hadoop本地运行模式(官方WordCount)

#1.创建在hadoop-3.3.1文件下面创建一个wcinput文件夹
[atguigu@hadoop102 hadoop-3.3.1]$ mkdir wcinput

#2.在wcinput文件下创建一个word.txt文件
[atguigu@hadoop102 hadoop-3.3.1]$ cd wcinput

#3.编辑word.txt文件
[atguigu@hadoop102 wcinput]$ vim word.txt
hadoop yarn
hadoop mapreduce
atguigu
atguigu

#4.回到Hadoop目录/opt/module/hadoop-3.3.1,执行程序
[atguigu@hadoop102 hadoop-3.3.1]$ hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-3.3.1.jar wordcount wcinput wcoutput

#5.查看结果
[atguigu@hadoop102 hadoop-3.3.1]$ cat wcoutput/part-r-00000
看到如下结果:
atguigu 2
hadoop  2
mapreduce       1
yarn    1
原文地址:https://www.cnblogs.com/jhno1/p/15209611.html