1、hdfs使用
$ hdfs dfs -ls / # 查看hdfs文件系统中根目录
$ hdfs dfs -mkdir /wc/input # 在根目录下创建一个目录wc # 上传文件到hdfs文件系统中
$ hadoop fs /usr/local/hadoop-2.9.0/etc/hadoop/*.xml /wc/input
2、mapreduce例子运行
运行测试例子:
$ cd /usr/local/hadoop-2.9.0/share/hadoop/mapreduce/
$ hadoop jar hadoop-mapreduce-examples-2.9.0.jar wordcount /wc/input /wc/output
1)页面查看
访问master:8088,查看到任务。
点击Utillities/Browse the file system---->输入/---->进入 wc---->output---->part-r-00000(计算过程查看)---->Head the file---->tail the file
2)命令查看
$ hadoop fs -ls /wc/output/
$ hadoop fs -text /wc/output/part-r-00000 # 查看文本文件(推荐)
或者
$ hadoop fs -cat /wc/output/part-r-00000