Spark在Ambari集群环境的使用
進入安裝sparkclient的節(jié)點
hdfs準備一個文件
su - hdfs
vi text.txt
隨便寫幾行東西
?
#創(chuàng)建目錄
hdfs dfs -mkdir /user/hdfs/test
#上傳文件
hdfs dfs -put test.txt /user/hdfs/test/
#檢查文件是否在
hdfs dfs -ls /user/hdfs/test/
#檢查內(nèi)容是否對
hdfs dfs -cat /user/hdfs/test/test.txt
?
spark在yarn上運行參見官方文檔
http://spark.apache.org/docs/latest/running-on-yarn.html
進入spark-shell
spark-shell --master yarn --deploy-mode client
統(tǒng)計下
scala> sc.textFile("/user/hdfs/test/test.txt").count()
res0: Long = 7
?
scala> sc.stop()
再次刷新Spark History Server頁面即可
http://192.168.128.55:18081/?showIncomplete=false
?
spark-submit提交任務(wù)到y(tǒng)arn
spark-submit --class org.whq.sparkTest.MLTest1 \
--master yarn \
--deploy-mode cluster \
--driver-memory 4g \
--executor-memory 2g \
--executor-cores 1 \
--queue default \
spark244test_2.11-0.1.jar \
10
?
--deploy-mode cluster集群模式,多個application,每個application啟動一個Driver在集群的多臺worker(NodeManager)上啟動。
--deploy-mode client客戶端模式,多個application,每個application啟動一個Driver只在本機運行,與集群產(chǎn)生大量通訊。
總結(jié)
以上是生活随笔為你收集整理的Spark在Ambari集群环境的使用的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 洛谷 题解 P2312 【解方程】
- 下一篇: C#参考资料