对hdfs的操做方式:hadoop fs xxxlinux
1.查询操做 服务器
hadoop fs -ls / (默认本机查询)分布式
hadoop fs - ls hdfs://hadoop:9000/ (分布式环境下查询)oop
hadoop fs -lsr / 递归查询spa
以下图(图中红框中1表示文件的副本数,目录没有):递归
2.建立文件夹操做:hadoop
hadoop fs -mkdir /hadooptestget
3.上传文件操做:test
hadoop fs -put /root/install.log /hadooptest 从linux传到hdfs服务器下载
4.下载文件操做:
hadoop fs -get /hadooptest/install.log / (从hdfs下载到linux,用ls查询便可)
5.查看文件内容:
hadoop fs -text /hadooptest/install.log 查看文件内容
6.删除文件操做:
hadoop fs -rm /hadooptest/install.log(只能删除文件)
hadoop fs -rmr /hadooptest(删除目录)
7.hadoop查询指令集
hadoop 查询全部指令
hadoop fs 显示fs指令全部可行操做
hadoop fs -help 显示操做含义