It has been 396 days since the last update, the content of the article may be outdated.

测试 Hadoop 安装及 wordcount 实例

第二章 测试 Hadoop 安装

(1)实验目的

测试 hadoop 的正常安装

(2)实验内容

使用 mapreduce 中的 wordcount 程序进行文件的单词统计

(3)实验基础知识

Hadoop 相关指令

(5)实验步骤

浏览器地址栏输入 http://192.168.237.130:50070/explorer.html#/,进入 datanode

在 hadoop 中新建文件夹,命令如下:

plaintext
hadoop fs -mkdir -p /test

推送文件 1.txt 到新建的 /test 下:

plaintext
hadoop fs -put 1.txt /test 

执行 wordcount 并把结果生成在 /output 下:

plaintext
hadoop jar /usr/hadoop/hadoop-2.10.1/share/hadoop/mapreduce/hadoop-mapreduce-examples-2.10.1.jar wordcount /test/1.txt /output

显示结果:

plaintext
hadoop fs -cat /output/*

(6)实验结果

分布式文件系统

统计结果

想了解 Hadoop 配置过程,可以看一下之前这篇文章 [[第一章 hadoop 环境搭建]]