報錯如下:
Initial job has not accepted any resources : Investigating the cluster state
查看spark的8080頁面發(fā)現(xiàn),兩個任務(wù)資源不夠用
(借用的圖,忘記截屏了转捕,但是意思一樣)
主要是因為spark默認為應(yīng)用有一個初始分配資源的配置,如果機器配置不合理惦积,就會導(dǎo)致資源申請失敗
需要修改spark-defaults.conf下的兩個參數(shù):
spark.deploy.defaultCores 1
spark.cores.max 2
注: spark.cores.max會將spark.deploy.defaultCores配置覆蓋掉
修改之后重啟spark集群,和thrift-server服務(wù)器
sbin/start-all.sh
sbin/start-thriftserver.sh --executor-cores 1 --executor-memory 512m
sbin/spark-sql --executor-cores 1 --executor-memory 1g
無奈的是猛频,這里只有--executor-memory 生效了狮崩,--executor-cores 沒生效蛛勉,所以綜合起來解決該問題的辦法就是重新分配資源,資源包括內(nèi)存和core核心數(shù)的分配睦柴。
更多配置诽凌,之后在詳細了解。
效果圖:
參考如下:http://www.open-open.com/lib/view/open1451574185448.html