文档:
安装scala
https://www.scala-lang.org/download/wget -P /opt/downloads https://downloads.lightbend.com/scala/2.13.0/scala-2.13.0.rpm
rpm -ivh /opt/downloads/scala-2.13.0.rpm
环境变量
vim /etc/profileexport SCALA_HOME=/usr/scala-2.13.0export PATH=$PATH:$SCALA_HOME/bin生效
source /etc/profile
检查
scala -version
集群(略)
安装Spark
https://www.apache.org/dyn/closer.lua/spark/spark-2.4.3/spark-2.4.3-bin-hadoop2.7.tgzwget -P /opt/downloads http://mirrors.tuna.tsinghua.edu.cn/apache/spark/spark-2.4.3/spark-2.4.3-bin-hadoop2.7.tgz
wget -P /opt/downloads http://mirror.bit.edu.cn/apache/spark/spark-2.4.3/spark-2.4.3-bin-hadoop2.7.tgztar zxvf /opt/downloads/spark-2.4.3-bin-hadoop2.7.tgz -C /optmv /opt/spark-2.4.3-bin-hadoop2.7/ /opt/sparkcp /opt/spark/conf/spark-env.sh.template /opt/spark/conf/spark-env.sh
vim /opt/spark/conf/spark-env.shexport JAVA_HOME=/usr/java/jdk1.8.0_201-amd64
export SCALA_HOME=/usr/share/scalaexport HADOOP_HOME=/opt/hadoopexport HADOOP_CONF_DIR=/opt/hadoop/etc/hadoopexport SPARK_MASTER_IP=0.0.0.0export SPARK_MASTER_PORT=7077export SPARK_MASTER_WEBUI_PORT=28080export SPARK_WORKER_WEBUI_PORT=28081export SPARK_WORKER_MEMORY=4gexport SPARK_WORKER_CORES=2export SPARK_WORKER_INSTANCES=1其中默认的8080和8081端口太容易冲突,建议修改下。
cp /opt/spark/conf/slaves.template /opt/spark/conf/slaves
vim /opt/spark/conf/slaves修改ip
启动
先启动hadoop/opt/spark/sbin/start-all.sh/opt/spark/sbin/stop-all.sh
查看start-all.sh文件cat /opt/spark/sbin/start-all.sh
可以发现它加载了spark-config.sh配置文件,启动了集群master主节点和slaves子节点。
启动后webui地址 http://192.168.1.xxx:28080