首先依次在终端输入命令
sudo service ssh restart重启ssh服务。
start-dfs.sh启动HDFS,
start-yarn.sh启动yarn。
然后输入jps命令查看进程
输入vi article.data创建article.data并进入文件,按i键进行内容编辑模式,输入this is an example回车this is another example,然后按esc退出编辑模式,再输入:wq保存并退出文件
输入hadoop fs -mkdir /wordcount
输入hadoop fs -mkdir /wordcount/srcdata创建文件夹
输入hadoop fs -put article.data /wordcount/srcdata/上传文件
输入hadoop fs -ls /wordcount/srcdata/查看文件
扫描二维码关注公众号,回复:
6516126 查看本文章
输入cd ~/bigdata hadoop jar WordCount.jar com.bit.WordCount /wordcount/srcdata/ /wordcount/output进行计算
再输入hdfs dfs -cat /wordcount/output/part-r-00000查看计算结果