【Hadoop】 2.7.3版本 hdfs 命令行使用

1.查看HDFS下目录结构及文件

dream361@ubuntu:~$ hdfs dfs -ls -R /

2.创建文件目录/tmp

dream361@ubuntu:~$ hdfs dfs -mkdir /tmp

3.复制当前目录下a.txts到HDFS文件系统

dream361@ubuntu:~$ hdfs dfs -put a.txt /inputFile

4.列出/tmp目录

dream361@ubuntu:~$ hdfs dfs -ls /tmp

5.查看/inputFile/a.txt文件内容

dream361@ubuntu:~$ hdfs dfs -cat /inputFile/a.txt
Not Support zh_CN.UTF-8
cannot output Chinese LANGUAGE

6.删除/tmp目录

dream361@ubuntu:~$ hdfs dfs -rm /tmp
rm: `/tmp': Is a directory
dream361@ubuntu:~$ hdfs dfs -rm -r /tmp
17/02/25 19:38:25 INFO fs.TrashPolicyDefault: Namenode trash configuration: Deletion interval = 0 minutes, Emptier interval = 0 minutes.
Deleted /tmp

7.查看HDFS状态

dream361@ubuntu:~$ hdfs dfsadmin -report
Configured Capacity: 14662287360 (13.66 GB)
Present Capacity: 7529889792 (7.01 GB)
DFS Remaining: 7529844736 (7.01 GB)
DFS Used: 45056 (44 KB)
DFS Used%: 0.00%
Under replicated blocks: 0
Blocks with corrupt replicas: 0
Missing blocks: 0
Missing blocks (with replication factor 1): 0

-------------------------------------------------
Live datanodes (1):

Name: 127.0.0.1:50010 (localhost)
Hostname: localhost
Decommission Status : Normal
Configured Capacity: 14662287360 (13.66 GB)
DFS Used: 45056 (44 KB)
Non DFS Used: 7132397568 (6.64 GB)
DFS Remaining: 7529844736 (7.01 GB)
DFS Used%: 0.00%
DFS Remaining%: 51.36%
Configured Cache Capacity: 0 (0 B)
Cache Used: 0 (0 B)
Cache Remaining: 0 (0 B)
Cache Used%: 100.00%
Cache Remaining%: 0.00%
Xceivers: 1
Last contact: Sat Feb 25 19:41:39 PST 2017

8.离开或进入安全模式

dream361@ubuntu:~$ hdfs dfsadmin -safemode leave
Safe mode is OFF
dream361@ubuntu:~$ hdfs dfsadmin -safemode enter
Safe mode is ON

 




 

转载于:https://www.cnblogs.com/zhengwenqiang/p/6804605.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值