Hadoop HDFS操作命令总结
Hadoop HDFS操作命令总结
1.列出根目录下所有的目录或文件
hadoop fs -ls /
2.列出/logs目录下的所有目录和文件
hadoop fs -ls /logs
3.列出/user目录及其子目录下的所有文件(谨慎使用)
hadoop fs -ls -R /user
4.创建/soft目录
hadoop fs -mkdir /soft
5.创建多级目录
hadoop fs -mkdir -p /apps/windows/2017/01/01
6.将本地的wordcount.jar文件上传到/wordcount目录下
hadoop fs -put wordcount.jar /wordcount
7.下载words.txt文件到本地
hadoop fs -get /words.txt
8.将/stu/students.txt文件拷贝到本地
hadoop fs -copyToLocal /stu/students.txt
9.将word.txt文件拷贝到/wordcount/input/目录
hadoop fs -copyFromLocal word.txt /wordcount/input
10.将word.txt文件从本地移动到/wordcount/input/目录下
hadoop fs -moveFromLocal word.txt /wordcount/input/
11.将/stu/students.txt拷贝一份为/stu/students.txt.bak
hadoop fs -cp /stu/students.txt /stu/students.txt.bak
12.将/flume/tailout/目录下的子目录或文件都拷贝到/logs目录(如果此目录不存在会创建)下
hadoop fs -cp /flume/tailout/ /logs
13.将/word.txt文件重命名为/words.txt
hadoop fs -mv /word.txt /words.txt
14.将/words.txt文件移动到/wordcount/input/目录下
hadoop fs -mv /words.txt /wordcount/input/
15.将/ws目录以及子目录和文件都删除(谨慎使用)
hadoop fs -rm -r /ws
16.删除以"xbs-"开头的目录及其子目录
hadoop fs -rm -r /xbs-*
17.将/wordcount/output2/目录下的a.txt文件删除
hadoop fs -rm /wordcount/output2/a.txt
18.将/wordcount/input/目录下面的所有文件都删除
hadoop fs -rm /wordcount/input/*
19.查看HDFS集群的磁盘空间使用情况
hadoop fs -df -h
20.查看/word.txt文件的内容
hadoop fs -cat /word.txt
21.将name.txt文件中的内容添加到/wordcount/input/words.txt文件中
hadoop fs -appendToFile name.txt /wordcount/input/words.txt
22.动态查看/wordcount/input/words.txt文件的内容
hadoop fs -tail -f /wordcount/input/words.txt
23.统计/flume目录总大小
hadoop fs -du -s -h /flume
24.分别统计/flume目录下各个子目录(或文件)大小
hadoop fs -du -s -h /flume/*
25.运行jar包中的程序
//hadoop jar + 要执行的jar包 + 要运行的类 + 输入目录 + 输出目录
hadoop jar wordcount.jar com.xuebusi.hadoop.mr.WordCountDriver /wordcount/input /wordcount/out
26.查看hdfs集群状态
hdfs dfsadmin -report
[root@hadoop03 apps]# hdfs dfsadmin -report
Configured Capacity: 55737004032 (51.91 GB)
Present Capacity: 15066578944 (14.03 GB)
DFS Remaining: 14682021888 (13.67 GB)
DFS Used: 384557056 (366.74 MB)
DFS Used%: 2.55%
Under replicated blocks: 7
Blocks with corrupt replicas: 0
Missing blocks: 0 -------------------------------------------------
Live datanodes (3): Name: 192.168.71.11:50010 (hadoop01)
Hostname: hadoop01
Decommission Status : Normal
Configured Capacity: 18579001344 (17.30 GB)
DFS Used: 128180224 (122.24 MB)
Non DFS Used: 16187543552 (15.08 GB)
DFS Remaining: 2263277568 (2.11 GB)
DFS Used%: 0.69%
DFS Remaining%: 12.18%
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: Mon Jan 09 11:17:43 PST 2017 Name: 192.168.71.13:50010 (hadoop03)
Hostname: hadoop03
Decommission Status : Normal
Configured Capacity: 18579001344 (17.30 GB)
DFS Used: 128196608 (122.26 MB)
Non DFS Used: 13623074816 (12.69 GB)
DFS Remaining: 4827729920 (4.50 GB)
DFS Used%: 0.69%
DFS Remaining%: 25.98%
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: Mon Jan 09 11:17:41 PST 2017 Name: 192.168.71.12:50010 (hadoop02)
Hostname: hadoop02
Decommission Status : Normal
Configured Capacity: 18579001344 (17.30 GB)
DFS Used: 128180224 (122.24 MB)
Non DFS Used: 10859806720 (10.11 GB)
DFS Remaining: 7591014400 (7.07 GB)
DFS Used%: 0.69%
DFS Remaining%: 40.86%
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: Mon Jan 09 11:17:42 PST 2017
27.查看hadoop fs命令使用帮助
[root@hadoop01 hadoop]# hadoop fs
Usage: hadoop fs [generic options]
[-appendToFile <localsrc> ... <dst>]
[-cat [-ignoreCrc] <src> ...]
[-checksum <src> ...]
[-chgrp [-R] GROUP PATH...]
[-chmod [-R] <MODE[,MODE]... | OCTALMODE> PATH...]
[-chown [-R] [OWNER][:[GROUP]] PATH...]
[-copyFromLocal [-f] [-p] [-l] <localsrc> ... <dst>]
[-copyToLocal [-p] [-ignoreCrc] [-crc] <src> ... <localdst>]
[-count [-q] [-h] <path> ...]
[-cp [-f] [-p | -p[topax]] <src> ... <dst>]
[-createSnapshot <snapshotDir> [<snapshotName>]]
[-deleteSnapshot <snapshotDir> <snapshotName>]
[-df [-h] [<path> ...]]
[-du [-s] [-h] <path> ...]
[-expunge]
[-get [-p] [-ignoreCrc] [-crc] <src> ... <localdst>]
[-getfacl [-R] <path>]
[-getfattr [-R] {-n name | -d} [-e en] <path>]
[-getmerge [-nl] <src> <localdst>]
[-help [cmd ...]]
[-ls [-d] [-h] [-R] [<path> ...]]
[-mkdir [-p] <path> ...]
[-moveFromLocal <localsrc> ... <dst>]
[-moveToLocal <src> <localdst>]
[-mv <src> ... <dst>]
[-put [-f] [-p] [-l] <localsrc> ... <dst>]
[-renameSnapshot <snapshotDir> <oldName> <newName>]
[-rm [-f] [-r|-R] [-skipTrash] <src> ...]
[-rmdir [--ignore-fail-on-non-empty] <dir> ...]
[-setfacl [-R] [{-b|-k} {-m|-x <acl_spec>} <path>]|[--set <acl_spec> <path>]]
[-setfattr {-n name [-v value] | -x name} <path>]
[-setrep [-R] [-w] <rep> <path> ...]
[-stat [format] <path> ...]
[-tail [-f] <file>]
[-test -[defsz] <path>]
[-text [-ignoreCrc] <src> ...]
[-touchz <path> ...]
[-usage [cmd ...]]
Hadoop HDFS操作命令总结的更多相关文章
- Hadoop HDFS常用操作命令
hadoop常用命令:hadoop fs查看Hadoop HDFS支持的所有命令 hadoop fs –ls列出目录及文件信息 hadoop fs –lsr循环列出目录.子目录及文件信息 hadoop ...
- (转)hadoop基本操作命令
http://www.cnblogs.com/gpcuster/archive/2010/06/04/1751538.html 在这篇文章中,我们默认认为Hadoop环境已经由运维人员配置好直接可以使 ...
- HADOOP基本操作命令
在这篇文章中,我们默认认为Hadoop环境已经由运维人员配置好直接可以使用. 假设Hadoop的安装目录HADOOP_HOME为/home/admin/hadoop. 启动与关闭 启动HADOOP 进 ...
- Hadoop HDFS 中的一些常用命令
转载自:hadoop HDFS常用文件操作命令 命令基本格式: hadoop fs -cmd < args > 1.ls hadoop fs -ls / 列出hdfs文件系统根目录下的目录 ...
- Hadoop(HDFS,YARN)的HA集群安装
搭建Hadoop的HDFS HA及YARN HA集群,基于2.7.1版本安装. 安装规划 角色规划 IP/机器名 安装软件 运行进程 namenode1 zdh-240 hadoop NameNode ...
- Hadoop HDFS 用户指南
This document is a starting point for users working with Hadoop Distributed File System (HDFS) eithe ...
- Hadoop HDFS负载均衡
Hadoop HDFS负载均衡 转载请注明出处:http://www.cnblogs.com/BYRans/ Hadoop HDFS Hadoop 分布式文件系统(Hadoop Distributed ...
- Hive:org.apache.hadoop.hdfs.protocol.NSQuotaExceededException: The NameSpace quota (directories and files) of directory /mydir is exceeded: quota=100000 file count=100001
集群中遇到了文件个数超出限制的错误: 0)昨天晚上spark 任务突然抛出了异常:org.apache.hadoop.hdfs.protocol.NSQuotaExceededException: T ...
- Hadoop程序运行中的Error(1)-Error: org.apache.hadoop.hdfs.BlockMissingException
15/03/18 09:59:21 INFO mapreduce.Job: Task Id : attempt_1426641074924_0002_m_000000_2, Status : FAIL ...
随机推荐
- 20.custom自定义线程池
自定义线程池 1.若Executors工厂类无法满足需求,可以自己使用工厂类创建线程池,底层都是使用了); ThreadPoolExecutor threadPoolExecutor = new Th ...
- Delphi DBGrid图显用法
procedure TForm10.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;DataCol: Integer; Column: ...
- 标准C++类std::string的内存共享和Copy-On-Write技术
标准C++类std::string的 内存共享和Copy-On-Write技术 陈皓 1. 概念 Scott Meyers在<More Effective C++>中举了个例子,不知你是 ...
- Android -- 重写BaseAdapter以及对ListView的优化
背景 对于ListView.GridView.Gallery.Spinner等等,它是它们的适配器,直接继承自接口类Adapter的,使用BaseAdapter时需要重写很多方法,其中最重要的当属ge ...
- HTML中的attribute和property
一.概述 attribute和property是常常被弄混的两个概念. 简单来说,property则是JS代码里访问的: document.getElementByTagName('my-elemen ...
- Mac下的 /private 是个什么目录?
Mac下的 /private 是个什么目录? 学习了:https://www.zhihu.com/question/19582264/answer/125522314 有图有真想
- synthesis-of-weak-property-only-allowed-in-arc-or-gc-mode ARC属性
synthesis-of-weak-property-only-allowed-in-arc-or-gc-mode ARC属性 错误提示: 1:确认你的项目是 ARC环境: 2:如果 ARC下出现上面 ...
- Sword框架解析——知识采集流程页面初始化
Sword框架解析——知识采集流程页面初始化 Sword框架解析知识采集流程页面初始化 问题解答流程采集新增页面初始化 1后台t_xt_gnzy表和BLH类 2BLH类的写法前台目录树代码 3登录系统 ...
- sublime text3 3176激活码
sublime text3 3176激活码 改host文件 #sublime 127.0.0.1 license.sublimehq.com 127.0.0.1 45.55.255.55 127. ...
- SqlServer聚合函数
聚合函数对一组值计算后返回单个值.除了count(统计项数)函数以外,其他的聚合函数在计算式都会忽略空值(null).所有的聚合函数均为确定性函数.即任何时候使用一组相同的输入值调用聚合函数执行后的返 ...