spark集群环境搭建

1.安装jdk
参考https://blog.51cto.com/13001751/1980999

2.安装scala
下载路径: https://downloads.lightbend.com/scala/2.12.8/scala-2.12.8.tgz scala-2.12.8.tgz
把下载包上传解压
tar -zxvf scala-2.12.8.tgz
rm -rf scala-2.12.8.tgz
配置环境变量
vi /etc/profile
export SCALA_HOME=/usr/local/scala-2.12.8
export PATH=$PATH:$JAVA_HOME/bin:$SCALA_HOME/bin
复制到其他节点:
scp -r scala-2.12.8 192.168.0.109:/usr/local/
scp -r scala-2.12.8 192.168.0.110:/usr/local/
scp /etc/profile 192.168.0.109:/etc/
scp /etc/profile 192.168.0.110:/etc/
使环境变量生效:source /etc/profile
验证:scala -version

3.ssh 免密码登录
参考https://blog.51cto.com/13001751/2487972

4.安装hadoop
参考https://blog.51cto.com/13001751/2487972

5.安装spark
把下载包上传解压
cd /usr/local/
tar -zxvf spark-2.4.5-bin-hadoop2.7.tgz
cd /usr/local/spark-2.4.5-bin-hadoop2.7/conf/ #进入spark配置目录
mv spark-env.sh.template spark-env.sh #从配置模板复制
vi spark-env.sh #添加配置内容
export SPARK_HOME=/usr/local/spark-2.4.5-bin-hadoop2.7
export SCALA_HOME=/usr/local/scala-2.12.8
export JAVA_HOME=/usr/local/jdk1.8.0_191
export HADOOP_HOME=/usr/local/hadoop-2.7.7
export PATH=$PATH:$JAVA_HOME/bin:$HADOOP_HOME/bin:$HADOOP_HOME/sbin:$SCALA_HOME/bin
export HADOOP_CONF_DIR=$HADOOP_HOME/etc/hadoop
export YARN_CONF_DIR=$HADOOP_HOME/etc/hadoop
export SPARK_MASTER_IP=spark1
SPARK_LOCAL_DIRS=/usr/local/spark-2.4.5-bin-hadoop2.7
SPARK_DRIVER_MEMORY=1G
export SPARK_LIBARY_PATH=.:$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$HADOOP_HOME/lib/native、
vi slaves
spark2
spark3
scp -r /usr/local/spark-2.4.5-bin-hadoop2.7 :/usr/local/
scp -r /usr/local/spark-2.4.5-bin-hadoop2.7 :/usr/local/
./sbin/start-all.sh(不可直接start-all.sh,这个命令是hadoop的)
spark集群环境搭建

相关推荐