四 Spark Spark的Java操作实现

编译出来的包位于target目录下,pro-spark-example-2.2.0.jar
启动spark集群
[root@testceph ~]# cd /usr/local/spark-2.2.0-bin-hadoop2.6/sbin
[root@testceph sbin]# ./start-all.sh
[root@testceph sbin]# cd ../
[root@testceph bin]# ./spark-submit

上传文件
[root@testceph ~]# hdfs dfs -ls /
Found 1 items
drwx-wx-wx   - root supergroup          0 2018-12-27 19:04 /tmp
[root@testceph ~]#
[root@testceph ~]# hdfs dfs -mkdir /spark
[root@testceph ~]# hdfs dfs -mkdir /spark/example
[root@testceph ~]# hdfs dfs -copyFromLocal a.sh /spark/example/


运行spark任务
[root@testceph ~]# ./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

猜你喜欢

转载自blog.csdn.net/xsjzdrxsjzdr/article/details/85417225
今日推荐