Hadoop场景案例参数调优
创始人
2025-05-29 08:48:14
0

目录

1 需求

2 HDFS参数调优

(1)修改:hadoop-env.sh

(2)修改hdfs-site.xml

(3)修改core-site.xml

(4)分发配置

3 MapReduce参数调优

(1)修改mapred-site.xml

(2)分发配置

4 Yarn参数调优

(1)修改yarn-site.xml配置参数如下

(2)分发配置

5 执行程序

(1)重启集群

(2)执行WordCount程序

(3)观察Yarn任务执行页面


1 需求

(1)需求:从1G数据中,统计每个单词出现次数。服务器3台,每台配置4G内存,4核CPU,4线程。

(2)需求分析:

1G / 128m = 8个MapTask;1个ReduceTask;1个mrAppMaster

平均每个节点运行10个 / 3台 ≈ 3个任务(4     3     3)

2 HDFS参数调优

(1)修改:hadoop-env.sh

export HDFS_NAMENODE_OPTS="-Dhadoop.security.logger=INFO,RFAS -Xmx1024m"export HDFS_DATANODE_OPTS="-Dhadoop.security.logger=ERROR,RFAS -Xmx1024m"

(2)修改hdfs-site.xml

dfs.namenode.handler.count21

(3)修改core-site.xml

fs.trash.interval60

(4)分发配置

xsync hadoop-env.sh hdfs-site.xml core-site.xml

3 MapReduce参数调优

(1)修改mapred-site.xml

mapreduce.task.io.sort.mb100mapreduce.map.sort.spill.percent0.80mapreduce.task.io.sort.factor10mapreduce.map.memory.mb-1The amount of memory to request from the scheduler for each    map task. If this is not specified or is non-positive, it is inferred from mapreduce.map.java.opts and mapreduce.job.heap.memory-mb.ratio. If java-opts are also not specified, we set it to 1024.mapreduce.map.cpu.vcores1mapreduce.map.maxattempts4mapreduce.reduce.shuffle.parallelcopies5mapreduce.reduce.shuffle.input.buffer.percent0.70mapreduce.reduce.shuffle.merge.percent0.66mapreduce.reduce.memory.mb-1The amount of memory to request from the scheduler for each    reduce task. If this is not specified or is non-positive, it is inferredfrom mapreduce.reduce.java.opts and mapreduce.job.heap.memory-mb.ratio.If java-opts are also not specified, we set it to 1024.mapreduce.reduce.cpu.vcores2mapreduce.reduce.maxattempts4mapreduce.job.reduce.slowstart.completedmaps0.05mapreduce.task.timeout600000

(2)分发配置

xsync mapred-site.xml

4 Yarn参数调优

(1)修改yarn-site.xml配置参数如下

The class to use as the resource scheduler.yarn.resourcemanager.scheduler.classorg.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacitySchedulerNumber of threads to handle scheduler interface.yarn.resourcemanager.scheduler.client.thread-count8Enable auto-detection of node capabilities such asmemory and CPU.yarn.nodemanager.resource.detect-hardware-capabilitiesfalseFlag to determine if logical processors(such ashyperthreads) should be counted as cores. Only applicable on Linuxwhen yarn.nodemanager.resource.cpu-vcores is set to -1 andyarn.nodemanager.resource.detect-hardware-capabilities is true.yarn.nodemanager.resource.count-logical-processors-as-coresfalseMultiplier to determine how to convert phyiscal cores tovcores. This value is used if yarn.nodemanager.resource.cpu-vcoresis set to -1(which implies auto-calculate vcores) andyarn.nodemanager.resource.detect-hardware-capabilities is set to true. The number of vcores will be calculated as number of CPUs * multiplier.yarn.nodemanager.resource.pcores-vcores-multiplier1.0Amount of physical memory, in MB, that can be allocatedfor containers. If set to -1 andyarn.nodemanager.resource.detect-hardware-capabilities is true, it isautomatically calculated(in case of Windows and Linux).In other cases, the default is 8192MB.yarn.nodemanager.resource.memory-mb4096Number of vcores that can be allocatedfor containers. This is used by the RM scheduler when allocatingresources for containers. This is not used to limit the number ofCPUs used by YARN containers. If it is set to -1 andyarn.nodemanager.resource.detect-hardware-capabilities is true, it isautomatically determined from the hardware in case of Windows and Linux.In other cases, number of vcores is 8 by default.yarn.nodemanager.resource.cpu-vcores4The minimum allocation for every container request at the RM  in MBs. Memory requests lower than this will be set to the value of this    property. Additionally, a node manager that is configured to have less memory than this value will be shut down by the resource manager.yarn.scheduler.minimum-allocation-mb1024The maximum allocation for every container request at the RM  in MBs. Memory requests higher than this will throw an    InvalidResourceRequestException.yarn.scheduler.maximum-allocation-mb2048The minimum allocation for every container request at the RM  in terms of virtual CPU cores. Requests lower than this will be set to the value of this property. Additionally, a node manager that is configured to  have fewer virtual cores than this value will be shut down by the resource    manager.yarn.scheduler.minimum-allocation-vcores1The maximum allocation for every container request at the RM  in terms of virtual CPU cores. Requests higher than this will throw anInvalidResourceRequestException.yarn.scheduler.maximum-allocation-vcores2Whether virtual memory limits will be enforced forcontainers.yarn.nodemanager.vmem-check-enabledfalseRatio between virtual memory to physical memory when    setting memory limits for containers. Container allocations are    expressed in terms of physical memory, and virtual memory usage   is allowed to exceed this allocation by this ratio.yarn.nodemanager.vmem-pmem-ratio2.1

(2)分发配置

xsync yarn-site.xml

5 执行程序

(1)重启集群

sbin/stop-yarn.shsbin/start-yarn.sh

(2)执行WordCount程序

hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-3.1.3.jar wordcount /input /output

(3)观察Yarn任务执行页面

http://hadoop103:8088/cluster/apps

相关内容

热门资讯

银行、消金公司助贷余额增速不得... 近日,中国证券报记者从多位业内人士处独家获悉,5月以来,多地金融监管部门对部分中小银行、消金公司下达...
朱鸿接任陈航,担任钉钉科技有限... 消费日报-今朝新闻讯 天眼查显示,6月23日,钉钉科技有限公司发生工商变更,陈航卸任法定代表人、董事...
3日累跌超20%,德创环保:公... 6月25日, 德创环保(603177.SH)公告,公司股票于2026年6月23日、6月24日和6月2...
北京发布2026年第七轮拟供商... 央广网北京6月25日消息(记者门庭婷)6月25日,北京市规划和自然资源委员会网站发布了2026年第七...
开放麦 | 启明创投胡奇:从A... “2026年,创投圈的浪潮再次翻涌:AI从技术概念走进产业深水区,硬科技创业从“小众赛道” 变成“主...
腾讯孙忠怀:在行业转身处 6月24日,2026腾讯视频年度发布在上海举行。腾讯公司副总裁、腾讯在线视频董事长孙忠怀以《在行业转...
加息,突变!美联储,重磅传来!... 美联储政策路径突生变数。 美国商务部经济分析局最新公布的数据显示,5月个人消费支出(PCE)物价指数...
6月合肥上门收金必看!5步避坑... 2026年6月,合肥黄金市场持续高位运行,不少市民翻出家里闲置的旧金饰、投资金条想变现,上门回收因为...
潮汕女富豪挂帅后加码液冷!祥鑫... 潮汕女强人,带着百亿公司加码液冷散热。 6月24日晚间,祥鑫科技(002965.SZ)公告称,公司董...
马斯克向太空要电,GobiX ... 一场关于「去哪里找电」的全球竞赛,正在朝两个方向展开。 作者|周永亮 编辑| 郑玄 「太空光伏是不是...
原料药行业陷入周期低谷 有药企... 每经记者|许立波 每经编辑|魏文艺 “过完年到现在,我们整个团队每个月都在出差,跑遍了亚非拉、欧美市...
家门口筛查白内障!永顺泽家镇暖... 大众卫生报·新湖南客户端6月25日讯(通讯员 彭雪姣)为切实解决辖区老年性白内障患者异地就医奔波、就...
终于等到!油价马上再大跌,这个... 点击添加图片描述(最多60个字) 编辑 各位车主朋友,好消息接二连三! 继6月18日油价大幅下调...
丈量出海新路 世界酒庄影响力指... 长期以来,全球酒庄评价体系由西方机构主导,且大多局限于单一酒种、单一评价维度,这一局面正逐渐被打破。...
峰瑞资本创始合伙人李丰:从资本... “2026年,创投圈的浪潮再次翻涌:AI从技术概念走进产业深水区,硬科技创业从“小众赛道” 变成“主...
原创 A... 迈向成熟,还有茁壮成长的机会。 作者 | 方璐 编辑丨于婞 来源 | 野马财经 2026年6月21日...
为企业解锁出海新通道!亚太中小... 6月24日下午,作为2026年APEC中小企业工商论坛的重要组成部分,亚太中小企业国际化合作发展论坛...
君赛生物港股IPO,增聘兴证国... 跟丰宜科技一样,正冲刺港股IPO的上海君赛生物股份有限公司(简称“君赛生物”)增聘一位整体协调人。 ...
圣邦股份明日上市:暗盘涨24%... 雷递网 雷建平 6月25日 圣邦微电子(北京)股份有限公司(简称:“圣邦股份”,股票代码:“0366...
科技“吃肉”,券商跟着“喝汤”... 当科技持续成为市场核心主线,押中硬科技项目的券商也成为被追逐的焦点。 6月24日,半导体零部件概念股...