随着数据量越来越大,在一个操作系统存不下所有的数据,那么就分配到更多的操作系统管理的磁盘中,但是不方便管理和维护,迫切需要一种系统来管理多台机器上的文件,这就是分布式文件管理系统。HDFS只是分布式文件管理系统中的一种。
HDFS(Hadoop Distributed File System),它是一个文件系统,用于存储文件,通过目录树来定位文件;其次,它是分布式的,由很多服务器联合起来实现其功能,集群中的服务器有各自的角色。
HDFS的使用场景:适合一次写入,多次读出的场景。一个文件经过创建、写入和关闭之后就不需要改变。
高容错性
数据自动保存多个副本。它通过增加副本的形式,提高容错性。
某一个副本丢失以后,它可以自动回复。
适合处理大数据
可构建在廉价机器上,通过副本机制,提高可靠性。
HDFS中的文件在物理上是分块存储(Block),块的大小可以通过配置参数(dfs.blocksize)来规定,默认大小在Hadoop2.x/3.x版本中是128M,1.x中是64M。
总结:HDFS块的大小设置主要取决于磁盘传输速率。
hadoop fs 具体命令 OR hdfs dfs 具体命令
两个是完全相同的。
输入 hadoop fs 就能看见hdfs的命令
[sherry@hadoop102 bin]$ hadoop fs
Usage: hadoop fs [generic options][-appendToFile ... ][-cat [-ignoreCrc] ...][-checksum ...][-chgrp [-R] GROUP PATH...][-chmod [-R] PATH...][-chown [-R] [OWNER][:[GROUP]] PATH...][-copyFromLocal [-f] [-p] [-l] [-d] [-t ] ... ][-copyToLocal [-f] [-p] [-ignoreCrc] [-crc] ... ][-count [-q] [-h] [-v] [-t []] [-u] [-x] [-e] ...][-cp [-f] [-p | -p[topax]] [-d] ... ][-createSnapshot []][-deleteSnapshot ][-df [-h] [ ...]][-du [-s] [-h] [-v] [-x] ...][-expunge][-find ... ...][-get [-f] [-p] [-ignoreCrc] [-crc] ... ][-getfacl [-R] ][-getfattr [-R] {-n name | -d} [-e en] ][-getmerge [-nl] [-skip-empty-file] ][-head ][-help [cmd ...]][-ls [-C] [-d] [-h] [-q] [-R] [-t] [-S] [-r] [-u] [-e] [ ...]][-mkdir [-p] ...][-moveFromLocal ... ][-moveToLocal ][-mv ... ][-put [-f] [-p] [-l] [-d] ... ][-renameSnapshot ][-rm [-f] [-r|-R] [-skipTrash] [-safely] ...][-rmdir [--ignore-fail-on-non-empty] ...][-setfacl [-R] [{-b|-k} {-m|-x } ]|[--set ]][-setfattr {-n name [-v value] | -x name} ][-setrep [-R] [-w] ...][-stat [format] ...][-tail [-f] [-s ] ][-test -[defsz] ][-text [-ignoreCrc] ...][-touch [-a] [-m] [-t TIMESTAMP ] [-c] ...][-touchz ...][-truncate [-w] ...][-usage [cmd ...]]Generic options supported are:
-conf specify an application configuration file
-D define a value for a given property
-fs specify default filesystem URL to use, overrides 'fs.defaultFS' property from configurations.
-jt specify a ResourceManager
-files specify a comma-separated list of files to be copied to the map reduce cluster
-libjars specify a comma-separated list of jar files to be included in the classpath
-archives specify a comma-separated list of archives to be unarchived on the compute machinesThe general command line syntax is:
command [genericOptions] [commandOptions]
sbin/start-dfs.sh
hadoop fs -help rm
hadoop fs -mkdir /wly
vim shuguo.txt
# 输入:
wly
hadoop fs -moveFromLocal ./wly.txt /wly
浏览器进入hadoop102:9870,进入Browse Directory
然后进入Linux查看是否是剪切
确认剪切
上一篇:[MAUI] 开篇-初识MAUI
下一篇: 汪曾祺小说的艺术特色分析