分布式系统详解--框架(Hadoop-基本shell命令)
前面的文章我们已经将一个集群搭建好了,现在就需要知道一些关于hadoop的基本操作命令,这篇文章就简单介绍一下hadoop的基本操作shell命令。
一、安装hadoop后,hadoop fs
在常用命令上进行了标注。
[root@MyLinux hadoop-2.7.5]# 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] [-find <path> ... <expression> ...] [-get [-p] [-ignoreCrc] [-crc] <src> ... <localdst>] //复制文件到本地,可以忽略crc校验 [-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>] //从本地中复制文件到hdfs [-moveToLocal <src> <localdst>] [-mv <src> ... <dst>] //移动多个文件到目标目录 [-put [-f] [-p] [-l] <localsrc> ... <dst>] //本地文件复制到hdfs [-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> ...] //创建一个空文件 [-truncate [-w] <length> <path> ...] [-usage [cmd ...]] Generic options supported are -conf <configuration file> specify an application configuration file -D <property=value> use value for given property -fs <local|namenode:port> specify a namenode -jt <local|resourcemanager:port> specify a ResourceManager -files <comma separated list of files> specify comma separated files to be copied to the map reduce cluster -libjars <comma separated list of jars> specify comma separated jar files to include in the classpath. -archives <comma separated list of archives> specify comma separated archives to be unarchived on the compute machines. The general command line syntax is bin/hadoop command [genericOptions] [commandOptions]
二、查看配置信息后的参数
hdfs getconf 执行后会告诉你一个参数
hdfs getconf -confkey fs.defaultFS 执行后会告诉你hdfs://hadoop02:9000
hdfs getconf -confkey dfs.blocksize 执行后会告诉你134217728
hdfs getconf -confkey dfs.replication 执行后会告诉你