mapreduce出现类似死锁情况

本文介绍了一种MapReduce任务中的死锁现象,即由于资源分配不均导致map和reduce任务相互等待,最终造成任务长时间无法完成的问题。文中详细分析了问题的原因,并提出通过调整mapreduce.job.reduce.slowstart.completedmaps参数来优化资源分配的方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >



MR-------------Error------------------


Reducer preempted to make room for pending map attempts Container killed by the ApplicationMaster. Container killed on request. Exit code is 143 Container exited with a non-zero exit code 143



在MR 运行过程中 ,某个mapreduce跑了8个多小时还没跑,看yarn界面,发现map还有一小部分没跑完,没跑完的map全在pending,running中没有,同时reduce在copy阶段把资源全用光,导致map没资源去跑,进而导致reduce一直在copy状态等待。也就是说map需要资源去跑,reduce需要等map全部跑完才能进行下一个阶段,这样就导致相互等待,类似死锁。大约在一个半小时左右,有4个reduce被AppMaster kill,

被kill的reduce出现日志:Reducer preempted to make room for pending map attempts Container killed by the ApplicationMaster. Container killed on request. Exit code is 143 Container exited with a non-zero exit code 143。这就是说当资源不够是,AppMaster会kill掉reduce释放资源给map。解决办法是调整mapreduce.job.reduce.slowstart.completedmaps参数,默认为0.05,即map完成0.05后reduce就开始copy,如果集群资源不够,有可能导致reduce把资源全抢光,可以把这个参数调整到0.8,map完成80%后才开始reduce copy。

h@node1:~$ hadoop jar SougouQ-1.0-SNAPSHOT.jar com.mapreduce.sogou.sogouMain \ > /input/sogou/SogouQ.reduced /output/sogou_cleaned \ > -Dmapreduce.map.memory.mb=2048 \ > -Dmapreduce.reduce.memory.mb=2048 2025-06-16 21:32:04,723 INFO client.RMProxy: Connecting to ResourceManager at node1/192.168.61.128:8032 2025-06-16 21:32:05,375 WARN mapreduce.JobResourceUploader: Hadoop command-line option parsing not performed. Implement the Tool interface and execute your application with ToolRunner to remedy this. 2025-06-16 21:32:05,393 INFO mapreduce.JobResourceUploader: Disabling Erasure Coding for path: /tmp/hadoop-yarn/staging/h/.staging/job_1750071296455_0010 2025-06-16 21:32:05,673 INFO input.FileInputFormat: Total input files to process : 1 2025-06-16 21:32:06,597 INFO mapreduce.JobSubmitter: number of splits:2 2025-06-16 21:32:06,655 INFO Configuration.deprecation: yarn.resourcemanager.system-metrics-publisher.enabled is deprecated. Instead, use yarn.system-metrics-publisher.enabled 2025-06-16 21:32:07,218 INFO mapreduce.JobSubmitter: Submitting tokens for job: job_1750071296455_0010 2025-06-16 21:32:07,220 INFO mapreduce.JobSubmitter: Executing with tokens: [] 2025-06-16 21:32:07,502 INFO conf.Configuration: resource-types.xml not found 2025-06-16 21:32:07,502 INFO resource.ResourceUtils: Unable to find 'resource-types.xml'. 2025-06-16 21:32:07,604 INFO impl.YarnClientImpl: Submitted application application_1750071296455_0010 2025-06-16 21:32:07,658 INFO mapreduce.Job: The url to track the job: http://node1:8088/proxy/application_1750071296455_0010/ 2025-06-16 21:32:07,660 INFO mapreduce.Job: Running job: job_1750071296455_0010 为什么卡着不动
最新发布
06-17
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值