2017-03-02 48 views
0

以下是我的火花集羣詳細信息 - 內存 - 29.3GB和10個內核。作業使用的執行程序的火花數量

enter image description here

現在我運行此作業,

火花提交--master火花:// Hadoop的主人:7077 --executor-1G內存 - 執行 - 芯2 /家/ hduser /ratings-counter.py

但是當我點擊完成的應用程序,我看到5執行器正在執行。

spark如何決定執行5個executor?

enter image description here

回答

1

從火花配置docs

spark.executor.cores : The number of cores to use on each executor. In standalone and Mesos coarse-grained modes, setting this parameter allows an application to run multiple executors on the same worker, provided that there are enough cores on that worker. Otherwise, only one executor per application will run on each worker.

如你有10個核和已設定執行程序型磁芯爲2時,它生成5個執行者。

+0

我想要3個執行者使用3個核心... spark-submit --master spark:// hadoop-master:7077 --executor-memory 2g --num-executors 3 --executor-cores 2 --verbose /home/hduser/ratings-counter.py...這從來沒有發生......它總是踢5個執行者......任何想法? – user1050619

0

這裏解釋的問題與微調有關。更多信息可在以下網址找到: http://blog.cloudera.com/blog/2015/03/how-to-tune-your-apache-spark-jobs-part-2/

要設置執行程序的數量,您需要打開YARN。 核心數=作爲執行程序的併發任務可以運行(使用hdfs時,建議將其保持在5以下)。 因此,對於您的示例,我們將--executor-cores設置爲3,而不是像以上評論中的@ user1050619那樣設置爲2。 然後執行者的數量是10/3〜3。爲了確保這是受控制的,您可以在評論--num-executors中使用@ user1050619的說法。 在上述問題的UI中,執行者的限制是5,所以如果有足夠的內存,它會嘗試達到此目的。解決此問題的一種方法是使用dynamic allocation。這允許更細粒度的控制。這裏可以使用以下選項設置最大執行程序的數量:spark.dynamicAllocation.maxExecutors,然後初始執行程序也可以設置爲3:spark.dynamicAllocation.initialExecutors

相關問題