---
title: "HDFS使用"
author: "cakin24"
date: "2017-10-18T21:32:51Z"
tags: []
categories: ["开源软件"]
slug: "hdfs"
draft: false
lastmod: "2017-10-18T21:27:27Z"
id: 2396888
url: "https://cakin24.iteye.com/blog/2396888"
---

一 HDFS命令行操作演示

\[root@localhost ~]# hadoop fs -ls /

Warning: $HADOOP\_HOME is deprecated.

 

Found 1 items

drwxr-xr-x - root supergroup 0 2017-08-20 11:23 /hadoop

 

\[root@localhost ~]# hadoop fs -ls /hadoop

Warning: $HADOOP\_HOME is deprecated.

 

Found 1 items

drwxr-xr-x - root supergroup 0 2017-08-20 11:40 /hadoop/mapred

\[root@localhost ~]# hadoop fs -mkdir input

Warning: $HADOOP\_HOME is deprecated.

 

\[root@localhost ~]# hadoop fs -ls

Warning: $HADOOP\_HOME is deprecated.

 

Found 1 items

drwxr-xr-x - root supergroup 0 2017-08-20 12:40 /user/root/input

 

\[root@localhost ~]# hadoop fs -ls /

Warning: $HADOOP\_HOME is deprecated.

 

Found 2 items

drwxr-xr-x - root supergroup 0 2017-08-20 11:23 /hadoop

drwxr-xr-x - root supergroup 0 2017-08-20 12:40 /user

\[root@localhost ~]# hadoop fs -put a.av input/

\[root@localhost ~]# hadoop fs -ls /user/root/input

Warning: $HADOOP\_HOME is deprecated.

 

Found 1 items

-rw-r--r-- 3 root supergroup 0 2017-08-20 12:44 /user/root/input/a.av

\[root@localhost ~]# hadoop fs -cat input/a.av

Warning: $HADOOP\_HOME is deprecated.

 

\[root@localhost ~]# hadoop fs -get input/a.av aa.av

Warning: $HADOOP\_HOME is deprecated.

 

\[root@localhost ~]# ls

123 cangls fping-4.0 monitor\_man shell16.sh system\_man.sh

aa.av canyls fping-4.0.tar.gz monitor\_man.sh shell5.sh Templates

a.av ChangeLog-2.6.0 hping-master Music student.txt test

 

\[root@localhost ~]# hadoop dfsadmin -report

Warning: $HADOOP\_HOME is deprecated.

 

Configured Capacity: 21464350720 (19.99 GB)

Present Capacity: 21046108160 (19.6 GB)

DFS Remaining: 21046083584 (19.6 GB)

DFS Used: 24576 (24 KB)

DFS Used%: 0%

Under replicated blocks: 1

Blocks with corrupt replicas: 0

Missing blocks: 0

 

\-------------------------------------------------

Datanodes available: 1 (1 total, 0 dead)

 

Name: 127.0.0.1:50010

Decommission Status : Normal

Configured Capacity: 21464350720 (19.99 GB)

DFS Used: 24576 (24 KB)

Non DFS Used: 418242560 (398.87 MB)

DFS Remaining: 21046083584(19.6 GB)

DFS Used%: 0%

DFS Remaining%: 98.05%

Last contact: Sun Aug 20 12:56:33 CST 2017