RELATEED CONSULTING
相关咨询
选择下列产品马上在线沟通
服务时间:8:30-17:00
你可能遇到了下面的问题
关闭右侧工具栏

新闻中心

这里有您想知道的互联网营销解决方案
Hadoop常用的操作命令(2)-创新互联
Hadoop常用的操作命令

列出目录清单
[root@centos67 ~]# hdfs dfs -ls /

递归列出目录清单
[root@centos67 ~]# hdfs dfs -lsr /

创建目录
[root@centos67 ~]# hdfs dfs -mkdir /input/test

删除目录
[root@centos67 ~]# hdfs dfs -rmr /input/test

创建文件
[root@centos67 ~]# hdfs dfs -touchz /input/test/test.txt

文件重命名
[root@centos67 ~]# hdfs dfs -mv /input/test/test.txt /input/test/test.exe

上传文件
[root@centos67 ~]# hdfs dfs -put ./test.log /input/test/

下载文件
[root@centos67 ~]# hdfs dfs -get /input/test/test.log ./

查看文件内容
[root@centos67 ~]# hdfs dfs -cat /input/test/test.log

删除文件
[root@centos67 ~]# hdfs dfs -rm /input/test/test.log

复制文件
[root@centos67 ~]# hdfs dfs -cp /input/test/test.log /test.log

统计目录下的所有文件大小
[root@centos67 ~]# hdfs dfs -du /input

统计整个目录大小
[root@centos67 ~]# hdfs dfs -dus /input

将指定目录下所有文件内容保存为一个文件,并且下载到本地
[root@centos67 ~]# hdfs dfs -getmerge /input/test ./test.txt

查看文件的最后1KB内容
[root@centos67 ~]# hdfs dfs /input/test/test.log

修改文件属主属组,可以加-R递归
[root@centos67 ~]# hdfs dfs -chown xiaomo:xiaomo /input/test/test.log

修改文件权限,可以加-R递归
[root@centos67 ~]# hdfs dfs -chmod 700 /input/test/test.log

统计当前文件/目录信息
目录数、文件数、文件大小、文件名/目录名
[root@centos67 ~]# hdfs dfs -count /input/test/test.log

清空回收站,文件被删除时,它首先会移到临时目录.Trash/中,
当超过延迟时间之后,文件才会被永久删除 
[root@centos67 ~]# hdfs dfs -expunge

[root@centos67 ~]# hdfs dfs -test /input
对/input进行如下类型的检查: 
-e 是否存在,如果存在,返回0,否则返回1 
-z 是否为空,如果长度为0,返回0,否则返回1 
-d 是否为目录,如果为目录,返回0,否则返回1 

显示文件内容,压缩文件会解压
[root@centos67 ~]# hdfs dfs -text /input/test/test.log

查看某个命令的帮助
[root@centos67 ~]# hdfs dfs -help ls
[root@centos67 ~]# hdfs dfs -help touchz

将正在运行的hadoop作业kill掉
[root@centos67 ~]# hdfs job –kill [job-id]

超过十多年行业经验,技术领先,服务至上的经营模式,全靠网络和口碑获得客户,为自己降低成本,也就是为客户降低成本。到目前业务范围包括了:网站建设、成都做网站,成都网站推广,成都网站优化,整体网络托管,微信平台小程序开发,微信开发,手机APP定制开发,同时也可以让客户的网站和网络营销和我们一样获得订单和生意!

另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。


分享文章:Hadoop常用的操作命令(2)-创新互联
分享链接:http://scyingshan.cn/article/djjscg.html