hdfs

1.原理

0 读写

https://blog.csdn.net/whdxjbw/article/details/81072207

1 文件格式

https://www.cnblogs.com/wqbin/p/14635480.html

Hadoop中的文件格式大致上分为面向行和面向列两类

面向行:同一行的数据存储在一起,即连续存储。SequenceFile,MapFile,Avro Datafile。采用这种方式,如果只需要访问行的一小部分数据,亦需要将整行读入内存,推迟序列化一定程度上可以缓解这个问题,但是从磁盘读取整行数据的开销却无法避免。面向行的存储适合于整行数据需要同时处理的情况。

面向列:整个文件被切割为若干列数据,每一列数据一起存储。Parquet , RCFile,ORCFile。面向列的格式使得读取数据时,可以跳过不需要的列,适合于只处于行的一小部分字段的情况。但是这种格式的读写需要更多的内存空间,因为需要缓存行在内存中(为了获取多行中的某一列)。同时不适合流式写入,因为一旦写入失败,当前文件无法恢复,而面向行的数据在写入失败时可以重新同步到最后一个同步点,所以Flume采用的是面向行的存储格式。

2.使用

上传文件

1.页面

2.命令行

https://blog.csdn.net/tandelin/article/details/89514784

3.问题

Hadoop in Secure Mode

https://hadoop.apache.org/docs/stable/hadoop-project-dist/hadoop-common/SecureMode.html#:~:text=When%20Hadoop%20is%20configured%20to,or%20%2Fetc%2Fhosts%20files.

This document describes how to configure authentication for Hadoop in secure mode.

By default Hadoop runs in non-secure mode in which no actual authentication is required.By configuring Hadoop runs in secure mode, each user and service needs to be authenticated by Kerberos in order to use Hadoop services.

hadoop SafeMode

https://blog.csdn.net/bingduanlbd/article/details/51900512

https://developer.aliyun.com/article/566059#

https://hadoop.apache.org/docs/r2.4.1/hadoop-project-dist/hadoop-hdfs/HdfsUserGuide.html#Safemode

During start up the NameNode loads the file system state from the fsimage and the edits log file. It then waits for DataNodes to report their blocks so that it does not prematurely start replicating the blocks though enough replicas already exist in the cluster. During this time NameNode stays in Safemode. Safemode for the NameNode is essentially a read-only mode for the HDFS cluster, where it does not allow any modifications to file system or blocks. Normally the NameNode leaves Safemode automatically after the DataNodes have reported that most file system blocks are available. If required, HDFS could be placed in Safemode explicitly using bin/hadoop dfsadmin -safemode command. NameNode front page shows whether Safemode is on or off. A more detailed description and configuration is maintained as JavaDoc for setSafeMode().

安全模式是HDFS所处的一种特殊状态,在这种状态下,文件系统只接受读数据请求,而不接受删除、修改等变更请求。在NameNode主节点启动时,HDFS首先进入安全模式,DataNode在启动的时候会向namenode汇报可用的block等状态,当整个系统达到安全标准时,HDFS自动离开安全模式。如果HDFS出于安全模式下,则文件block不能进行任何的副本复制操作,因此达到最小的副本数量要求是基于datanode启动时的状态来判定的,启动时不会再做任何复制(从而达到最小副本数量要求)

hadoop调优

1 集群数据均衡

1 节点间数据均衡

(1)开启数据均衡命令

start-balancer.sh -threshold 10

(2)停止数据均衡命令

stop-balancer.sh

2 磁盘间数据均衡

(1)生成均衡计划(我们只有一块磁盘,不会生成计划)

hdfs diskbalancer -plan hadoop103

(2)执行均衡计划

hdfs diskbalancer -execute hadoop103.plan.json

(3)查看当前均衡任务的执行情况

hdfs diskbalancer -query hadoop103

(4)取消均衡任务

hdfs diskbalancer -cancel hadoop103.plan.json

2 数据压缩

https://cloud.tencent.com/developer/article/1417401

1 LZO压缩

LZO压缩文件的可切片特性依赖于其索引,故我们需要手动为LZO压缩文件创建索引。若无索引,则LZO文件的切片只有一个。

1
[atguigu@hadoop102 bin]$ hadoop jar /opt/module/hadoop-3.1.3/share/hadoop/common/hadoop-lzo-0.4.20.jar com.hadoop.compression.lzo.DistributedLzoIndexer /warehouse/gmall/ods/ods_log/dt=2020-06-14

3 Hadoop参数调优

https://developer.aliyun.com/article/566013

1)HDFS参数调优

2)YARN参数调优

hadoop架构

1 总览

https://blog.csdn.net/wangxudongx/article/details/104079998

2 hdfs

3 yarn

4 MapReduce

5 RPC

Remote Procdure Call,中文名:远程过程调用

它允许一台计算机程序远程调用另外一台计算机的子程序,而不用去关心底层的网络通信细节

Hadoop的进程间交互都是通过RPC来进行的,比如Namenode与Datanode

https://www.cnblogs.com/SmallBird-Nest/p/11430330.html

Hadoop部署

1 原理

https://blog.csdn.net/aohun0743/article/details/101702331

https://cloud.tencent.com/developer/article/1924241?from=article.detail.1336692

本地模式

单机运行,只是用来演示一下官方案例。生产环境不用。

伪分布式模式

也是单机运行,但是具备Hadoop集群的所有功能,一台服务器模拟一个分布式的环境。个别缺钱的公司用来测试,生产环境不用。

完全分布式模式

多台服务器组成分布式环境。生产环境使用。

搭建:

https://blog.csdn.net/a1786742005/article/details/104104983

高可用完全分布式模式

HA高可用是Hadoop2.x才开始引入的机制,是为了解决Hadoop的单点故障问题。主要有两种部署方式,一种是NFS(Network File System)方式,另外一种是QJM(Quorum Journal Manager)方式。用得较多的是QJM方式,稳定性更好。实际操作中,生产环境的Hadoop集群搭建一般都会做HA部署。

2 使用

配置客户端访问集群

3 问题


:D 一言句子获取中...