hdfs命令行操作

查看文件列表

[root@localhost opt]# hadoop fs -ls /
Found 2 items
drwxr-xr-x   - root supergroup          0 2017-11-18 03:49 /hadoop
drwxr-xr-x   - root supergroup          0 2017-11-18 04:00 /user

创建一个目录,我这里是root账户,会在/user/root/input生成

[root@localhost opt]# hadoop fs -mkdir input
[root@localhost opt]# hadoop fs -ls /user/root
Found 2 items
drwxr-xr-x   - root supergroup          0 2017-11-18 04:12 /user/root/input

删除目录

[root@localhost opt]# hadoop fs -rmr input
Deleted hdfs://192.168.24.136:9000/user/root/input

提交文件

[root@localhost opt]# touch test.txt
[root@localhost opt]# hadoop fs -put test.txt input
[root@localhost opt]# hadoop fs -ls /user/root/input
Found 1 items
-rw-r--r--   3 root supergroup          0 2017-11-18 04:19 /user/root/input/test.txt
[root@localhost opt]# 

获取文件到当前目录

[root@localhost opt]# hadoop fs -get input/test.txt test.txt

获取HDFS的状态信息

[root@localhost opt]# hadoop dfsadmin -report
Configured Capacity: 18645180416 (17.36 GB)
Present Capacity: 11589984256 (10.79 GB)
DFS Remaining: 11589943296 (10.79 GB)
DFS Used: 40960 (40 KB)
DFS Used%: 0%
Under replicated blocks: 1
Blocks with corrupt replicas: 0
Missing blocks: 0

-------------------------------------------------
Datanodes available: 1 (1 total, 0 dead)

Name: 192.168.24.136:50010
Decommission Status : Normal
Configured Capacity: 18645180416 (17.36 GB)
DFS Used: 40960 (40 KB)
Non DFS Used: 7055196160 (6.57 GB)
DFS Remaining: 11589943296(10.79 GB)
DFS Used%: 0%
DFS Remaining%: 62.16%
Last contact: Sat Nov 18 04:24:03 PST 2017
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值