一、上傳並解壓spark安裝包
[root@master]
[root@master spark]
/usr/local/src/spark
[root@master spark]
二、運行官方案例
[root@master spark]
--class org.apache.spark.examples.SparkPi \
--executor-memory 1G \
--total-executor-cores 2 \
./examples/jars/spark-examples_2.11-2.1.1.jar \
100
參數說明
參數說明:
--master 指定Master的地址,默認爲Local
--class: 你的應用的啓動類 (如 org.apache.spark.examples.SparkPi)
--deploy-mode: 是否發佈你的驅動到worker節點(cluster) 或者作爲一個本地客戶端 (client) (default: client)*
--conf: 任意的Spark配置屬性, 格式key=value. 如果值包含空格,可以加引號“key=value”
application-jar: 打包好的應用jar,包含依賴. 這個URL在集羣中全局可見。 比如hdfs:// 共享存儲系統, 如果是 file:// path, 那麼所有的節點的path都包含同樣的jar
application-arguments: 傳給main()方法的參數
--executor-memory 1G 指定每個executor可用內存爲1G
--total-executor-cores 2 指定每個executor使用的cup核數爲2個
三、運行spark-shell
[root@master spark]