設置nodemanager 總內存大小爲32G,在yarn-site.xml 增長以下內容:java
<property>
<name>yarn.nodemanager.resource.memory-mb</name>
<value>32768</value>
</property>
container內存按照默認大小配置,即爲最小1G,最大8Gnode
<property>
<name>yarn.scheduler.minimum-allocation-mb</name>
<value>1024</value>
</property>
<property>
<name>yarn.scheduler.maximum-allocation-mb</name>
<value>8192</value>
</property>
每一個任務最大jvm heap 大小爲1000M,在mapred-site.xml 增長以下內容:web
<property>
<name>mapred.child.java.opts</name>
<value>-Xmx1000M -Dfile.encoding=UTF8 -XX:-UseGCOverheadLimit</value>
</property>
FairScheduler調度器配置,在yarn-site.xml 增長以下內容:apache
<property>
<name>yarn.resourcemanager.scheduler.class</name> <value>org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairScheduler</value>
</property>
<property>
<name>yarn.scheduler.fair.allocation.file</name>
<value>/home/cluster/conf/hadoop/fair-scheduler.xml</value>
</property>
日誌聚合功能,在yarn-site.xml 增長以下內容:bash
<property>
<name>yarn.log-aggregation-enable</name>
<value>true</value>
</property>
<property>
<name>yarn.nodemanager.remote-app-log-dir</name>
<value>/var/log/hadoop-yarn/apps</value>
<description>Where to aggregate logs to.</description>
</property>
<property>
<name>yarn.log-aggregation.retain-seconds</name>
<value>86400</value>
</property>
開啓jobhistory服務markdown
<property>
<name>yarn.log.server.url</name>
<value>http://master:19888/jobhistory/logs/</value>
</property>
<property>
<name>mapreduce.jobhistory.address</name>
<value>master:10020</value>
</property>
<property>
<name>mapreduce.jobhistory.webapp.address</name>
<value>master:19888</value>
</property>
設置yarn heap 大小,在yarn-env.sh 增長以下內容:app
YARN_HEAPSIZE=6000
設置hadoop heap 大小,在hadoop-env.sh 增長以下內容:webapp
# The maximum amount of heap to use, in MB. Default is 1000.
export HADOOP_HEAPSIZE=6000
設置namenode jvm heap 大小,在hadoop-env.sh 增長以下內容:jvm
export HADOOP_NAMENODE_OPTS="-Xmx60000m -Dcom.sun.management.jmxremote -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCApplicationStoppedTime -Xloggc:/home/stark_summer/logs/hadoop-hdfs/gc-$(hostname)-hdfs.log $HADOOP_NAMENODE_OPTS"
設置datanode jvm heap 大小(繼承HADOOP_HEAPSIZE參數配置),在hadoop-env.sh 增長以下內容:oop
export HADOOP_NAMENODE_OPTS="-Dhadoop.security.logger=${HADOOP_SECURITY_LOGGER:-INFO,RFAS} -Dhdfs.audit.logger=${HDFS_AUDIT_LOGGER:-INFO,NullAppender} $HADOOP_NAMENODE_OPTS"
export HADOOP_DATANODE_OPTS="$JMX_BASE -Dcom.sun.management.jmxremote.port=26003 $HADOOP_DATANODE_OPTS"
export HADOOP_DATANODE_OPTS="-Dhadoop.security.logger=ERROR,RFAS $HADOOP_DATANODE_OPTS"
設置secondarynamenode jvm heap 大小,在hadoop-env.sh 增長以下內容:
export HADOOP_SECONDARYNAMENODE_OPTS="-Xms58320m -Xmx58320m -XX:-UseGCOverheadLimit -Dcom.sun.management.jmxremote $HADOOP_SECONDARYNAMENODE_OPTS"
export HADOOP_SECONDARYNAMENODE_OPTS="-Dhadoop.security.logger=${HADOOP_SECURITY_LOGGER:-INFO,RFAS} -Dhdfs.audit.logger=${HDFS_AUDIT_LOGGER:-INFO,NullAppender} $HADOOP_SECONDARYNAMENODE_OPTS"
設置 map & reduce 的container分配內存大小
-D mapreduce.map.memory.mb="1500" \
-D mapreduce.reduce.memory.mb="1500" \
設置 map & reduce 的 jvm heap 大小
-D mapreduce.map.java.opts="-Xms1600M -Xmx1600M -Dfile.encoding=UTF8 -XX:-UseGCOverheadLimit" \
-D mapreduce.reduce.java.opts="-Xms2500M -Xmx2500M -Dfile.encoding=UTF8 -XX:-UseGCOverheadLimit" \
等價於
-D mapred.map.child.java.opts="-Xms1600M -Xmx1600M -Dfile.encoding=UTF8 -XX:-UseGCOverheadLimit" \
-D mapred.reduce.child.java.opts="-Xms2500M -Xmx2500M -Dfile.encoding=UTF8 -XX:-UseGCOverheadLimit" \
設置shuffle比例,默認shuffle比例是0.70,可下降這個比例
-D mapreduce.reduce.shuffle.input.buffer.percent=0.4 \
設置隊列名稱
-D mapreduce.job.queuename=root.routine \
尊重原創,拒絕轉載
http://blog.csdn.net/stark_summer/article/details/48494391