首页 > 系统服务 > 详细

Hadoop系列(三)Hadoop三大核心之HDFS shell常用命令

时间:2019-08-30 09:11:51      阅读:92      评论:0      收藏:0      [点我收藏+]

HDFS常用命令

help 查看所有命令

[172.23.7.9:hadoop]$ hadoop fs help

查看路径文件

[172.23.7.9:hadoop]$ hadoop fs -ls /

创建文件夹

[172.23.7.9:hadoop]$ hadoop fs -mkdir /test

创建多级文件夹

[172.23.7.9:hadoop]$ hadoop fs -mkdir -p /test/test1/test2

查看指定目录下和子目录下所有文件

[172.23.7.9:hadoop]$ hadoop fs -ls -R /test

上传文件

[172.23.7.9:hadoop]$ hadoop fs -put part.txt /test

or

[172.23.7.9:hadoop]$ hadoop fs -copyFromLocal part.txt /test

下载文件

[172.23.7.9:hadoop]$ hadoop fs -get /test/part.txt ~/test

or

[172.23.7.9:hadoop]$ hadoop fs -copyToLocal /test/part.txt ~/test

合并下载

[172.23.7.9:hadoop]$ hadoop fs -getmerge /test/part0.txt /test/part1.txt ./temp.txt

复制

[172.23.7.9:hadoop]$ hadoop fs -cp /test/part.txt /output

移动

[172.23.7.9:hadoop]$ hadoop fs -mv /test/part.txt /output

删除

[172.23.7.9:hadoop]$ hadoop fs -rm /test/part.txt

强制删除

[172.23.7.9:hadoop]$ hadoop fs -rm -r /test/part.txt

查看文件内容

[172.23.7.9:hadoop]$ hadoop fs -cat /test/part.txt

显示文件大小

[172.23.7.9:hadoop]$ hadoop fs -du -h /test/part.txt

test

[172.23.7.9:hadoop]$ hadoop fs -test -[ezd] /test/part.txt

选项:
-e 检查文件是否存在。如果存在则返回0。
-z 检查文件是否是0字节。如果是则返回0。
-d 如果路径是个目录,则返回1,否则返回0。

web界面

http://xx.xx.xx.xx:9870/explorer.html#/

技术分享图片

Hadoop系列(三)Hadoop三大核心之HDFS shell常用命令

原文:https://www.cnblogs.com/valjeanshaw/p/11432864.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!