wget https://www.scala-lang.org/download/****
wget http://mirrors.tuna.tsinghua.edu.cn/apache/spark/spark-2.4.3/spark-2.4.3-bin-hadoop2.7.tgz tar -zxvf spark-2.4.3-bin-hadoop2.7.tgz rm spark-2.4.3-bin-hadoop2.7.tgz
vim /etc/profile
source /etc/profile
cp slaves.template slaves cp spark-env.sh.template spark-env.sh
vim /etc/profile(查看其它配置文件直接複製便可) vim ./spark-2.4.3-bin-hadoop2.7/conf vim spark-env.sh
/usr/local/hadoop-2.7.6/sbin/start-all.sh
/usr/local/spark-2.4.3-bin-hadoop2.7/sbin/start-all.sh
bin/run-example SparkPi
bin/run-example SparkPi 2>&1 | grep "Pi is"
bin/spark-shell
scala> textFile.first() // 獲取RDD文件textFile的第一行內容 scala> textFile.count() // 獲取RDD文件textFile的全部項的計數
scala> val lineWithSpark=textFile.filter(line=>line.contains("Spark"))// 抽取含有「Spark」的行,返回一個新的RDD
scala> lineWithSpark.count() //統計新的RDD的行數
scala> textFile.map(line=>line.split(" ").size).reduce((a,b)=>if(a>b) a else b) //找出文本中每行的最多單詞數
:quit