1. 程式人生 > >執行時候報異常could only be replicated to 0 nodes instead of minReplication (=1). There are 2 datanode(s) r

執行時候報異常could only be replicated to 0 nodes instead of minReplication (=1). There are 2 datanode(s) r

執行時候報異常could only be replicated to 0 nodes instead of minReplication (=1). There are 2 datanode(s) running and no node(s) are excluded in this operation.

執行時候報異常could only be replicated to 0 nodes instead of minReplication (=1).  There are 2 datanode(s) running and no node(s) are excluded in this operation.

解決方法:

1首先看一下dfs.replication的數目是否超過了datanode的數目,應該要小於或者等於datanode的數目。

2更改mapreduce。map.memory.mb的大小,把每個map任務的物理限制提高,程式碼如下,reduce同理。

<property> 
<name>mapreduce.map.memory.mb</name> 
<value>1024</value> 
<description>每個Map任務的實體記憶體限制</description> 
</property> 

yarn.scheduler.minimum-allocation-mb/yarn.scheduler.maximum-allocation-mb

引數解釋:單個可申請的最小/最大記憶體資源量。比如設定為1024和3072,則執行MapRedce作業時,每個Task最少可申請1024MB記憶體,最多可申請3072MB記憶體。

預設值:1024/8192

yarn.scheduler.minimum-allocation-vcores/yarn.scheduler.maximum-allocation-vcores

引數解釋:單個可申請的最小/最大虛擬CPU個數。比如設定為1和4,則執行MapRedce作業時,每個Task最少可申請1個虛擬CPU,最多可申請4個虛擬CPU。什麼是虛擬CPU,可閱讀我的這篇文章:“YARN 資源排程器剖析”。

預設值:1/32