HDP集群參數調優

前言:本文檔適用于新部署的HDP集群,需要修改默認參數值以提高集群的穩定性。


1.Mysql

修改mysql配置文件/etc/my.cnf

參數 說明 默認值 建議值

default-character-set mysql服務器默認字符集設置 ? utf8

max_connections 最大用戶連接數 151 3000

2.Ldap

ldap添加日志方便后期定位問題:

vi slapd.conf

loglevel 4095

vi /etc/rsyslog.conf

local4.* /var/log/openldap.log

service rsyslog restart

service slapd restart

3.Kerberos

參數 說明 默認值 建議值

hadoop.security.auth_to_local? 指定的規則將Kerberos主體映射到操作系統用戶(系統)帳戶 ? DEFAULT RULE:[2:$1/$2@$0](.*/.*@ocdp)s/(.*)@ocdp/.*/

4.Ambari-server

調整ambari-server堆內存,防止集群增大后,內存不足相應緩慢。

vi /var/lib/ambari-server/ambari-env.sh

export AMBARI_JVM_ARGS=$AMBARI_JVM_ARGS' -Xms1024m -Xmx4096m -XX:MaxPermSize=128m

5.Zookeeper

參數 說明 默認值 建議值

Zookeeper Server Maximum Memory? Zookeeper進程堆內存 1024? 4096

6.Hdfs

參數 說明 默認值 建議值

NameNode Java heap size Namenode進程堆內存 1024 51200

Namenode 內存調優

namenode 的元數據對象數包含文件的inodes 和指向datanode 數據塊的blocks。

元數據大致分成兩個層次:Namespace管理層,負責管理文件系統中的樹狀目錄結構以及文件與數據塊的映射關系;塊管理層,負責管理文件系統中文件的物理塊與實際存儲位置的映射關系BlocksMap

dfs.blocksize設置為128M,每個namenode 對象大概150 bytes,大概100W個block 消耗一個1G namenode memory

副本影響dfs的存儲空間,但不影響namenode 的內存

eg:

200 hosts of 24 TB each = 4800 TB.Blocksize=128 MB,?Replication=3

Cluster capacity in MB: 200 * 24,000,000 MB = 4,800,000,000 MB (4800 TB)

Disk space needed per block: 128 MB per block * 3 =?384 MB?storage per block

Cluster capacity in blocks: 4,800,000,000 MB / 384 MB =?12,000,000 blocks

集群大概需要12G 的heap size


生產集群namenode heapsize建議值:20480m~167936m(根據集群數據量大小調整)


其它參數優化:

參數 說明 默認值 建議值

dfs.namenode.handler.count Namenode處理線程數 10 200

dfs.datanode.handler.count Datanode處理線程數 10 160

DataNode maximum Java heap size Datanode進程堆內存 1024 4096

fs.trash.interval Hdfs垃圾回收時間 360 1440

dfs.datanode.balance.bandwidthPerSec Hdfs數據均衡帶寬 1048576 10485760

dfs.image.trsansfer.timeout Fsimage傳輸超時 60000 120000

dfs.image.transfer.bandwidthPerSec Fsimage傳輸帶寬 0 52428800

dfs.datanode.du.reserved Datanode磁盤預留空間 0 157286400

7.Yarn

Yarn進程內存配置:

參數 說明 默認值 建議值

ResourceManager Java heap size Resourcemanager進程堆內存 1024 16384

NodeManager Java heap size Nodemanager進程堆內存 1024 4096

AppTimelineServer Java heap size Timelineserver進程堆內存 1024 4096

Yarn資源配置

根據主機物理配置(32v,128G)進行建議

參數 說明 默認值 建議值

yarn.nodemanager.resource.cpu-vcores Nodemanager節點分配最大并發數(vcore) 8 32

yarn.nodemanager.resource.memory-mb Nodemanager節點分配最大內存數 8192 65536

yarn.scheduler.minimum-allocation-vcores 一個container分配最小vcore數 1 1

yarn.scheduler.maximum-allocation-vcores 一個container分配最大vcore數 32 32

yarn.scheduler.minimum-allocation-mb 一個container分配的最小內存 1024 1024

yarn.scheduler.maximum-allocation-mb 一個container分配的最大內存 8192 65536

8.Mapreduce

參數 說明 默認值 建議值

mapreduce.map.memory.mb Map進程堆內存 1024 2048

mapreduce.map.cpu.vcores Map配置的vcore數 1 1

mapreduce.reduce.memory.mb Reduce進程內存 1024 4096

mapreduce.reduce.cpu.vcores Reduce配置的vcore數 1 1

yarn.app.mapreduce.am.resource.mb MRAPPmaster進程內存 1536 4096

yarn.app.mapreduce.am.resource.cpu-vcores MRAPPmaster配置的vcore數 1 1

9.Hive

參數 說明 默認值 建議值

Client Heap Size Client進程堆內存 1024 1024

Metastore Heap Size Metastore進程堆內存 1024 5120

HiveServer2 Heap Size Hiveserver2進程堆內存 1024 8192

根據現場業務需要進行調整的參數:

參數 說明 默認值 建議值

hive.exec.compress.output Hive開啟輸出壓縮 false true

mapreduce.output.fileoutputformat.compress mapreduce輸出壓縮 false true

mapreduce.output.fileoutputformat.compress.type mapreduce輸出壓縮級別 RECORD BLOCK

mapreduce.output.fileoutputformat.compress.codec Mapreduce輸出壓縮算法 org.apache.hadoop.io.compress.DefaultCodec org.apache.hadoop.io.compress.SnappyCodec

hive.exec.compress.intermediate Hive中間結果壓縮 false true

mapreduce.map.output.compress mapreduce中間結果壓縮 false true

mapreduce.map.output.compress.codec mapreduce中間結果壓縮算法 org.apache.hadoop.io.compress.DefaultCodec org.apache.hadoop.io.compress.SnappyCodec

hive.execution.engine Hive執行引擎 mr tez

hive.exec.parallel Hive job并行執行 false true

hive.mapred.mode Hive是否過濾不合理查詢 nonstrict strict

hive.merge.mapredfiles Hive開啟文件合并 false true

hive.merge.size.per.task Hive文件合并大小 256000000 256000000

hive.merge.smallfiles.avgsize Hive文件合并大小平均值 16000000 256000000

mapreduce.input.fileinputformat.split.minsize 一個map處理的最小數據量 0 256000000

10.Hbase

參數 說明 默認值 建議值

HBase Master Maximum Memory Hbase master進程堆內存 1024 8192

HBase RegionServer Maximum Memory Hbase regionserver進程堆內存 1024 16384

參數 說明 默認值 建議值

hbase.regionserver.handler.count

Regionserver處理線程數 30 150

hbase.regionserver.global.memstore.upperLimit Hbase memory store內存占regionserver堆內存比例上限 0.2 0.4

hbase.regionserver.global.memstore.lowerLimit Hbase memory store內存占regionserver堆內存比例下限 0.18 0.35

hbase.hregion.memstore.flush.size Hbase Memory store內存數據刷到磁盤閾值 134217728 268435456

hbase.hstore.compactionThreshold

一次minor compaction的最小file數 5 10

hfile.block.cache.size storefile的讀緩存占用Heap的大小百分比 0.6 0.4

hbase.hstore.blockingStoreFiles 執行block flush的StoreFiles文件數量閥值 100 150

hbase.hstore.compaction.max 一次minor compaction的最大file數 10 20

hbase.hstore.compaction.min 一次minor compaction的最小file數 3 10

hbase.hregion.memstore.block.multiplier Flush最大的store內存(store個數),超過就block寫入。 2 8

hbase.server.thread.wakefrequency Block寫的延時時間 10000 100

11.Spark

參數 說明 默認值 建議值

spark_daemon_memory sparkThriftServer進程堆內存 1024 10240

spark.executor.cores 每個executor分配的vcore數 1 5

spark.executor.memory 每個executor分配的內存 1024 10240

spark.yarn.executor.memoryOverhead Spark executor預留內存 384 2048

12.Tez

參數 說明 默認值 建議值

tez.yarn.ats.event.flush.timeout.millis Tez job完成后刷新yarn job信息時間 -1 60000

?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容