关于Hadoop调优

Hadoop生产调优 一、HDFS—核心参数 1、NameNode 内存生产配置 1) NameNode 内存计算

每个文件块大概占用 150byte,一台服务器 128G 内存为例,能存储多少文件块呢?

128 * 1024 * 1024 * 1024 / 150Byte ≈ 9.1 亿

2) Hadoop2.x 系列,配置 NameNode 内存

​ NameNode 内存默认 2000m,如果服务器内存 4G,NameNode 内存可以配置 3g。在hadoop-env.sh 文件中配置如下。

HADOOP_NAMENODE_OPTS=-Xmx3072m 3) Hadoop3.x 系列,配置 NameNode 内存

(1)hadoop-env.sh 中描述 Hadoop 的内存是动态分配的

# The maximum amount of heap to use (Java -Xmx). If no unit # is provided, it will be converted to MB. Daemons will # prefer any Xmx setting in their respective _OPT variable. # There is no default; the JVM will autoscale based upon machine # memory size. # export HADOOP_HEAPSIZE_MAX= # 要使用的最大堆数量(Java -Xmx)。如果没有提供单位,它将被转换为MB。守护进程会更喜欢在它们各自的_OPT变量中设置任何Xmx。没有违约;JVM将根据机器内存大小自动伸缩。 # The minimum amount of heap to use (Java -Xms). If no unit # is provided, it will be converted to MB. Daemons will # prefer any Xms setting in their respective _OPT variable. # There is no default; the JVM will autoscale based upon machine # memory size. # export HADOOP_HEAPSIZE_MIN= # 要使用的最小堆数量(Java -Xms)。如果没有提供单位,它将被转换为MB。守护进程会更喜欢在它们各自的_OPT变量中设置任何Xms。没有违约;JVM将根据机器内存大小自动伸缩。 HADOOP_NAMENODE_OPTS=-Xmx102400m

(2)查看 NameNode 占用内存

[chaos@hadoop102 ~]$ jps 3088 NodeManager 2611 NameNode 3271 JobHistoryServer 2744 DataNode 3579 Jps [chaos@hadoop102 ~]$ jmap -heap 2611 Heap Configuration: MaxHeapSize = 1031798784 (984.0MB)

(3)查看 DataNode 占用内存

[chaos@hadoop102 ~]$ jmap -heap 2744 Heap Configuration: MaxHeapSize = 1031798784 (984.0MB)

查看发现 hadoop102 上的 NameNode 和 DataNode 占用内存都是自动分配的,且相等。不是很合理。 经验参考:

Component Memory CPU Disk
JournalNode 日志节点   1 GB (default)Set this value using the Java Heap Size of JournalNode in Bytes HDFS configuration property.
1 GB(默认)使用字节HDFS 配置属性中 JournalNodeJava 堆大小设置此值。
  1 core minimum
最少 1 个核心
  1 dedicated disk 1个专用磁盘  
NameNode   Minimum: 1 GB (for proof-of-concept deployments)
Add an additional 1 GB for each additional 1,000,000 blocksSnapshots and encryption can increase the required heap memory.
See Sizing NameNode Heap Memory
Set this value using the Java Heap Size of NameNode in Bytes HDFS configuration property.最低:1 GB(用于概念验证部署)
每增加 1,000,000 个block 增加 1 GB
快照和加密可以增加所需的堆内存。
请参阅调整 NameNode 堆内存大小
使用字节HDFS 配置属性中 NameNode的Java 堆大小设置此值。
  Minimum of 4 dedicated cores; more may be required for larger clusters
最少 4 个专用内核;更大的集群可能需要更多
  Minimum of 2 dedicated disks for metadata1 dedicated disk for log files (This disk may be shared with the operating system.)Maximum disks: 4
至少 2 个用于元数据的专用磁盘
1 个用于日志文件的专用磁盘(该磁盘可能与操作系统共享。)
最大磁盘数:4
 
DataNode   Minimum: 4 GBIncrease the memory for higher replica counts or a higher number of blocks per DataNode. When increasing the memory, Cloudera recommends an additional 1 GB of memory for every 1 million replicas above 4 million on the DataNodes. For example, 5 million replicas require 5 GB of memory.Set this value using the Java Heap Size of DataNode in Bytes HDFS configuration property.
最低:4 GB
增加内存以获得更高的副本计数或每个 DataNode 的更多块数。在增加内存时,Cloudera 建议为 DataNode 上 400 万个以上的每 100 万个副本增加 1 GB 内存。例如,500 万个副本需要 5 GB 内存。
使用字节HDFS 配置属性中 DataNode的Java 堆大小设置此值。
  Minimum: 4 cores. Add more cores for highly active clusters.
最低:4 核。为高度活跃的集群添加更多核心。
  Minimum: 4Maximum: 24The maximum acceptable size will vary depending upon how large average block size is. The DN’s scalability limits are mostly a function of the number of replicas per DN, not the overall number of bytes stored. That said, having ultra-dense DNs will affect recovery times in the event of machine or rack failure. Cloudera does not support exceeding 100 TB per data node. You could use 12 x 8 TB spindles or 24 x 4TB spindles. Cloudera does not support drives larger than 8 TB.
最少:4
最大:24
最大可接受大小将取决于平均块大小有多大。DN 的可扩展性限制主要取决于每个 DN 的副本数,而不是存储的总字节数。也就是说,如果机器或机架出现故障,拥有超密集 DN 将影响恢复时间。Cloudera 不支持每个数据节点超过 100 TB。您可以使用 12 x 8 TB 轴或 24 x 4TB 轴。Cloudera 不支持大于 8 TB 的驱动器。
 

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/zzsdfz.html