1、启动Hadoop集群
- 执行命令:
start-all.sh
2、准备文件
- 创建文件:
vim faith.txt
God, Grant me
the SERENITY, to accept the things I cannot change,
COURAGE to change the things I can,
and the WISDOM to know the difference.
Living one day at a time; Enjoying one moment at a time;
Accepting hardships as the pathway to peace.
Taking as He did, this sinful world as it is, not as I would have it;
Trusting that He will make all things right if I surrender to His Will.
That I may be reasonably happy in this life,
and supremely happy with Him forever in the next.
Amen
- 查看文件:
cat faith.txt
3、上传文件
- 传入HDFS指定目录(BigData):
- 检测是否成功:
- 使用用Hadoop WebUI查看文件是否上传成功:
- 运行词频统计程序的jar包:
- 命令解析:
- 查看词频统计结果:
hdfs dfs -cat /wc_result/*
- 误重复运行,会报‘输出目录存在错误’