文章内容输出来源:拉勾教育大数据高薪训练营
HDFS 分布式存储初体验
测试需求:从linux本地文件系统上传下载文件验证HDFS集群工作正常
1、在hdfs集群中创建一个文件目录,创建成功后可以在hdfs页面看到
hdfs dfs
-mkdir -p
/test/input
2、在本地创建一个文件
cd
/root
vim
test.txt
hello hdfs
3、
上传linux文件到Hdfs
hdfs dfs
-put
/root/test.txt /test/input
4、
从Hdfs下载文件到linux本地
hdfs dfs
-get
/test/input/test.txt
MapReduce 分布式计算初体验
需求:统计文本中的单词出现次数
1、在HDFS文件系统根目录下面创建一个wcinput文件夹
hdfs
dfs
-mkdir
/wcinput
2、
在
/root/
目录下创建一个
wc.txt
文件
(
本地文件系统
)
touch
wc
.txt
3、
上传
wc.txt
到
Hdfs
目录
/wcinput
下
4、在目录
/opt/lagou/servers/hadoop-2.9.2/share/hadoop/mapreduce/下执行程序
hadoop jar hadoop-mapreduce-examples-2.9.2.jar wordcount /wcinput /wcoutput
5、查看结果