1. 程式人生 > >四 Spark Spark的Java操作實現

四 Spark Spark的Java操作實現

編譯出來的包位於target目錄下,pro-spark-example-2.2.0.jar
啟動spark叢集
[[email protected] ~]# cd /usr/local/spark-2.2.0-bin-hadoop2.6/sbin
[[email protected] sbin]# ./start-all.sh
[[email protected] sbin]# cd ../
[[email protected] bin]# ./spark-submit

上傳檔案
[[email protected] ~]# hdfs dfs -ls /
Found 1 items
drwx-wx-wx   - root supergroup          0 2018-12-27 19:04 /tmp
[
[email protected]
~]# [[email protected] ~]# hdfs dfs -mkdir /spark [[email protected] ~]# hdfs dfs -mkdir /spark/example [[email protected] ~]# hdfs dfs -copyFromLocal a.sh /spark/example/ 執行spark任務 [[email protected] ~]# ./spark-submit --master spark://192.168.229.133:7077 --name WordCount --class org.apache.spark.examples.JavaWordCount /data/example/pro-spark-example-2.2.0.jar /spark/example/README.md