Hadoop运行模式之本地运行模式

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/m0_37294838/article/details/90019904

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

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

本地运行模式

 官方Grep案例

1. 创建在hadoop-2.7.2文件下面创建一个input文件夹

[atguigu@hadoop101 hadoop-2.7.2]$ mkdir input

2. 将Hadoop的xml配置文件复制到input

[atguigu@hadoop101 hadoop-2.7.2]$ cp etc/hadoop/*.xml input

3. 执行share目录下的MapReduce程序

[atguigu@hadoop101 hadoop-2.7.2]$ bin/hadoop jar

share/hadoop/mapreduce/hadoop-mapreduce-examples-2.7.2.jar grep input output 'dfs[a-z.]+'

4. 查看输出结果

[atguigu@hadoop101 hadoop-2.7.2]$ cat output/*

官方WordCount案例

1. 创建在hadoop-2.7.2文件下面创建一个wcinput文件夹

[atguigu@hadoop101 hadoop-2.7.2]$ mkdir wcinput

2. 在wcinput文件下创建一个wc.input文件

[atguigu@hadoop101 hadoop-2.7.2]$ cd wcinput

[atguigu@hadoop101 wcinput]$ touch wc.input

3. 编辑wc.input文件

[atguigu@hadoop101 wcinput]$ vi wc.input

在文件中输入如下内容

hadoop yarn
hadoop mapreduce
tt
tt

保存退出::wq

扫描二维码关注公众号,回复: 6176026 查看本文章

4. 回到Hadoop目录/opt/module/hadoop-2.7.2

5. 执行程序

[atguigu@hadoop101 hadoop-2.7.2]$ hadoop jar

 share/hadoop/mapreduce/hadoop-mapreduce-examples-2.7.2.jar wordcount wcinput wcoutput

6. 查看结果

[atguigu@hadoop101 hadoop-2.7.2]$ cat wcoutput/part-r-00000

tt 2

hadoop  2

mapreduce       1

yarn    1

猜你喜欢

转载自blog.csdn.net/m0_37294838/article/details/90019904