大数据学习2—— 分布式文件系统HDFS

软件版本

hadoop-2.6.0-cdh5.7.0.tar.gz

目录:

1.分布式文件系统HDFS
2.HDFS优缺点
3.分布式文件系统的设计思想
4.HDFS架构图
5.Hadoop下载和JDK的安装
6.shh安装及HDFS文件参数配置
7.HDFS shell操作
8.HDFS Java API编程
9.HDFS读写数据流程
10.hadoop新特性

11.HDFS日志收集实战案例


1.分布式文件系统HDFS

 

1) dataset 量达到一定规模时,那么单机就没有办法处理

2) 把数据分布到各个独立的机器上(多台机器共同协作)

 

官网查找资料,hadoop.apache.org

 



 

 

介绍

HDFSHadoop Distributed File System)是一个分布式的文件系统,被设计运行在廉价的硬盘上,和目前一些分布式的文件系统有很大的相似点,但是比起其它的分布式文件系统也有很大不同。HDFS是个高容错(fault-tolerant)的系统,被部署在廉价的硬盘上。HEFS提供高吞吐量来访问应用数据,并且适合大数据的访问。HDFS放松了一些POSIX的要求,使其能流式的访问文件系统。HDFS最开始是Apache Nutch搜索引擎的基础设备。HDFSapache的一个核心项目(The Hadoop Distributed File System (HDFS) is a distributed file system designed to run on commodity hardware. It has many similarities with existing distributed file systems. However, the differences from other distributed file systems are significant. HDFS is highly fault-tolerant and is designed to be deployed on low-cost hardware. HDFS provides high throughput access to application data and is suitable for applications that have large data sets. HDFS relaxes a few POSIX requirements to enable streaming access to file system data. HDFS was originally built as infrastructure for the Apache Nutch web search engine project. HDFS is part of the Apache Hadoop Core project. The project URL is http://hadoop.apache.org/

 

2.HDFS优缺点

分布式文件系统
1)dataset量达到一定规模时,那么单机就没办法进行处理
2)把数据分布到各个独立的机器上(多台机器共同协作)

优点 1.构建在廉价的机器上。 2.使用大数据处理。 3.高容错

官方说明

1. 硬件错误(Hardware Failure

硬件错误是一个常态而不是异常.一个HDFS有可能包含成百上千的服务机器,每一台服务器存储文件的一个部分。事实上包含很大的结构,每一部分很大可能出错,这意味着HDFS大部分是不能用的,因此,自动发现错误和快递自动的恢复他们是HDFS的一个目标。(Hardware failure is the norm rather than the exception. An HDFS instance may consist of hundreds or thousands of server machines, each storing part of the file system’s data. The fact that there are a huge number of components and that each component has a non-trivial probability of failure means that some component of HDFS is always non-functional. Therefore, detection of faults and quick, automatic recovery from them is a core architectural goal of HDFS.

2. 流式的访问数据(Streaming Data Access

HDFS上面的应用程序需要用流式的方式访问数据。这一点是他和普通的应用程序的区别.HDFS更多的是用于批处理,而不是用户的交互式使用。重点是数据访问的高吞吐量,而不是数据访问的低延迟。(Applications that run on HDFS need streaming access to their data sets. They are not general purpose applications that typically run on general purpose file systems. HDFS is designed more for batch processing rather than interactive use by users. The emphasis is on high throughput of data access rather than low latency of data access. POSIX imposes many hard requirements that are not needed for applications that are targeted for HDFS. POSIX semantics in a few key areas has been traded to increase data throughput rates.

3. 大规模的数据集(large Data Sets

HDFS运行的应用程序具有大数据集,一个典型的HDFS可以是gb,也可以是tb.HDFS被调优以支持大文件,它应该为单个集群中的数百个节点提供高聚合的数据带宽和规模,能能在在一个HDFS上支持数以千计的文件。(Applications that run on HDFS have large data sets. A typical file in HDFS is gigabytes to terabytes in size. Thus, HDFS is tuned to support large files. It should provide high aggregate data bandwidth and scale to hundreds of nodes in a single cluster. It should support tens of millions of files in a single instance.

4. 简单的一致性模式(Simple Coherency Model

HDFS是一个一次写入多次读取的模式。一个文件一旦创建,写入,关闭,就不会被更改,除非是附加和结尾。它能够把你添加的内容附加到文件末尾,但是不能任意点更新。这种假设就解决的数据一致性问题,使得支持高吞吐量访问。MapReduce应用和爬虫应用就适合这种模型。(HDFS applications need a write-once-read-many access model for files. A file once created, written, and closed need not be changed except for appends and truncates. Appending the content to the end of the files is supported but cannot be updated at arbitrary point. This assumption simplifies data coherency issues and enables high throughput data access. A MapReduce application or a web crawler application fits perfectly with this model.

5. 移动计算比移动数据更划算(Moving Computation is Cheaper than Moving Data”)

如果在其操作的数据附近执行,应用程序请求的计算效率会更高。当数据量非常大的时候,这一点非常重要,这将最小化网络拥塞,并增加系统的总体吞吐量。我们的假设是,将计算迁移到数据所在的位置,而不是将数据移动到应用程序运行的位置通常更好。(A computation requested by an application is much more efficient if it is executed near the data it operates on. This is especially true when the size of the data set is huge. This minimizes network congestion and increases the overall throughput of the system. The assumption is that it is often better to migrate the computation closer to where the data is located rather than moving the data to where the application is running. HDFS provides interfaces for applications to move themselves closer to where the data is located.

6. 异构软硬件平台之间的可移植性(Portability Across Heterogeneous Hardware and Software Platforms

HDFS被设计成易于从一个平台移植到另一个平台。这促进了HDFS的广泛采用,作为一组大型应用程序的首选平台。

 

缺点

不适合低延迟数据访问。 2.不适合小文件存储

3.分布式文件系统的设计思想

普通分布式文件系统的设计思想

1.一个文件存储在一个节点上

2.每个文件多副本方式存储

3.负载难以均衡。

举例,文件1是0.5T,文件2是1T,文件3是20g,文件3是50g

如果第一个机器挂掉了,没关系,其它机器还有副本


缺点;每个节点的数据大小不一样。每个机器的利用率不一样。网络瓶颈会产生。不利于并行操作。

HDFS分布式文件系统的设计思想

1.将一个文件拆分成多个Block

2.每个block以多副本的方式存储在各个节点上

3.保存元数据映射关系

4.负载均衡

5.分布式并行计算


下面举例:一个文件是50G,拆分成多个block,每个block是128M



4.HDFS架构图


HDFS是一个master/slave的架构,HDFS集群由一个NameNode组成,它是管理文件系统名称空间的主服务器,并管理客户端对文件的访问。此外,还有许多datanode,通常是集群中的一个节点,负责管理存储。HDFS公开一个文件系统名称空间,并允许将用户数据存储在文件中。在内部,一个文件被分割成一个或多个块,这些块存储在一组datanode中。NameNode执行文件系统名称空间操作,如打开,关闭,重命名文件和目录。它还决定了块到datanode的映射。datanode负责从文件系统的客户端提供读和写请求。datanode也会在NameNode的指令下执行块创建、删除和复制。(HDFS has a master/slave architecture. An HDFS cluster consists of a single NameNode, a master server that manages the file system namespace and regulates access to files by clients. In addition, there are a number of DataNodes, usually one per node in the cluster, which manage storage attached to the n

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值