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

相关内容

热门资讯

华熙生物赵燕谈胶原蛋白乱象:科... 21世纪经济报道记者雷晨 北京报道 近年来,重组胶原蛋白成为医美和护肤领域的热门概念,市场宣传中不乏...
富春染织完成董事会选举换届 开... 7月25日晚间,富春染织公告显示,当日,公司2025年第一次临时股东会和富春染织第四届第一次董事会在...
圣湘生物:两款产品取得医疗器械... 每经AI快讯,圣湘生物(SH 688289,收盘价:22.94元)7月27日晚间发布公告称,圣湘生物...
10年期国债收益率升至1.73... 近期债券市场出现显著调整,多重因素交织推动收益率持续上行。权益市场强势表现与大宗商品价格上涨形成合力...
当对手都在做下沉 蜜雪冰城旗下... [ 今年5月,蜜雪集团跟巴西签署40亿元人民币的采购意向大单,其中大多数是咖啡豆。 ] 当星巴克、瑞...
新手必看!股指期货交易规则基础... 股指期货交易规则,看似复杂抽象,实则与我们的日常生活有着奇妙的共通之处。它就像一场精心编排的生活交响...
王登发履新茅台技开公司“一把手... 一则微信公众号发布的信息,披露了茅台集团旗下的技术开发公司“一把手”已换人。 近日,南都湾财社-酒水...
特斯拉机器人V3量产版亮相!马... 快科技7月27日消息,特斯拉的Optimus人形机器人V3量产版终于要来了!马斯克在最近的财报电话会...
原创 中... 在金融全球化的浪潮中,中国资本市场始终勇立潮头,不断探索前行。7月26日,中国资本市场学会成立大会暨...
报告:我国经济增长保持韧性 下... 央广网北京7月27日消息(记者 樊瑞)近日,中国金融四十人论坛(CF40论坛)发布《2025年第二季...
超6300亿元!A股银行“分红... 7月25日,成都银行完成权益分派股权登记,将于7月28日发放现金红利,这标志着A股上市银行2024年...
老铺黄金:2025年上半年单个... 7月27日晚,老铺黄金(HK06181)披露2025年中期业绩预告。预计2025年上半年实现销售业绩...
保险行业2025年上半年回顾与... 今天分享的是:保险行业2025年上半年回顾与未来展望 报告共计:59页 2025年上半年保险行业回顾...
数币App上新!消费者、商户两... 数字人民币试点持续推进,相关数字钱包手机应用程序功能也在优化中。7月21日,北京商报记者注意到,日前...
A股热点迭出,个股连续涨停!资... 近段时间以来A股市场整体走势较为强劲,上周以来在雅江概念集体上行的推动下涨势更为明显,主要指数不同程...
原创 印... 令人惊讶的是,印度人开始反思自身制造业的发展状况。印度经济学家帕纳加利亚指出,印度原本有机会在20年...
首创证券拟赴港上市,“A+H”... 首创证券在A股上市不足三年便启动赴港上市计划。近日,首创证券公告称,公司董事会已审议通过了公司拟发行...
肥东杨大爷要帮“儿子”还钱,银... “儿子”在外借了2万元还不上 “要债人”电话直接打了过来 还?还是不还? 7月6日 肥东县公安局梁园...
A股上周16家上市公司公布并购... 转自:扬子晚报 扬子晚报网7月27日讯(记者 范晓林 薄云峰)近段时间以来,A股市场并购重组活跃度持...
独家|某股份行改动零售业务关键... 在资产端信贷“投不动”(多家行零售信贷增速连续几个季度放缓、更有甚者个贷投放负增长)、负债端存款“定...