因為配置了spark如下參數,啟動spark-shell報錯
export SPARK_WORKER_CORES=5
export SPARK_WORKER_INSTANCES=4
export SPARK_WORKER_MEMORY=50G
export SPARK_WORKER_WEBUI_PORT=8081
export SPARK_EXECUTOR_CORES=2
export SPARK_EXECUTOR_MEMORY=20G
15/07/07 15:52:47 INFO Client: Verifying our application has not requested more than the maximum memory capability of the cluster (8192 MB per container)
java.lang.IllegalArgumentException: Required executor memory (20480+1433 MB) is above the max threshold (8192 MB) of this cluster!
at org.apache.spark.deploy.yarn.Client.verifyClusterResources(Client.scala:162)
查看在cloudera的管理控制台查看yarn的配置(修改之前是8,改為32)
同時更改下nodemanager的最大內存(修改之前是8,改為24)
另外,因為任務是提交到YARN上運行的,所以YARN中有幾個關鍵參數,參考YARN的內存和CPU配置:
yarn.app.mapreduce.am.resource.mb :AM能夠申請的最大內存,默認值為1536MB
yarn.nodemanager.resource.memory-mb :nodemanager能夠申請的最大內存,默認值為8192MB
yarn.scheduler.minimum-allocation-mb :調度時一個container能夠申請的最小資源,默認值為1024MB
yarn.scheduler.maximum-allocation-mb :調度時一個container能夠申請的最大資源,默認值為8192MB
Spark On YARN內存分配:
http://www.tuicool.com/articles/YVFVRf3
http://www.sjsjw.com/107/001051MYM028913/