spark使用记录
单词统计的示例
1:客户端登录
2:使用链式编程输出结果文件
sc.textFile("hdfs://bda1node01.sqtxj.com:8020/txj/resources/chedai/chedai.csv").flatMap(_.split(",")).map((_,1)).reduceByKey(_+_).saveAsTextFile("/spark/out")
spark安装后示例(求pai)
1:
./bin/spark-submit --class org.apache.spark.examples.SparkPi --master yarn --executor-memory 1g --executor-cores 1 --total-executor-cores 4 --queue root.default ../examples/jars/spark-examples_2.12-3.2.1.jar 100
2:
./bin/spark-submit --class org.apache.spark.examples.SparkPi --master spark://bda1node01:7070 ./examples/jars/spark-examples_2.11-2.2.3.jar 100