官方:https://hadoop.apache.org/
文档:http://hadoop.apache.org/docs/r2.7.7/
一、本地模式(在hadoop目录下进行)
1、官方Grep案例
mkdir input
cp etc/hadoop/*.xml input
bin/hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-2.7.7.jar grep input output ‘dfs[a-z.]+‘
cat output/*
在自己的虚拟机上运行有点慢
2、官方WordCount案例
# 创建文件夹
mkdir wcinput
# 向文件写入内容
cd wcinput
touch wc.input
vim wc.input
hadoop yarn
hadoop mapreduce
tom
tom
tom
# 运行
hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-2.7.7.jar wordcount wcinput wcoutput
主要作用:查找wc.input 文件中 相同单词 出现的次数(wordcount)
二、伪分布式模式
三、完全分布式模式
原文:https://www.cnblogs.com/wt7018/p/13547247.html