赞
踩
Spark 安装包下载地址:https://archive.apache.org/dist/spark/
安装前提:安装 Spark 前需要先安装好 JDK
1. 上传并解压 Spark 安装包
spark-2.1.0-bin-hadoop2.7.tgz
[root@bigdata software]# tar -zxvf spark-2.1.0-bin-hadoop2.7.tgz -C .
2. 编辑配置文件
[root@bigdata software]# cd spark-2.1.0-bin-hadoop2.7/conf/
[root@bigdata conf]# cp spark-env.sh.template spark-env.sh
[root@bigdata conf]# vi spark-env.sh
# 将下边三行配置添加到文件最后
export JAVA_HOME=/software/jdk # 提前安装好jdk并将JDK安装包更名为jdk
export SPARK_MASTER_HOST=bigdata # 本机hostname
export SPARK_MASTER_PORT=7077
[root@bigdata conf]# cp slaves.template slaves
# 把文件最后一行的localhost改为本机hostname或ip
bigdata
3. 验证
${SPARK_HOME}/sbin
下执行[root@bigdata conf]# ../sbin/start-all.sh
[root@bigdata conf]# jps
1937 Master
2013 Worker
9869 Jps
172.16.15.111:8080
1. 将 spark-2.1.0-bin-hadoop2.7.tgz 上传至 hadoop0:/software/
下
2. 解压(在当前目录下)
tar -zxvf spark-2.1.0-bin-hadoop2.7.tgz -C .
3. 改名并配置Spark环境变量文件 spark-env.sh
[root@hadoop0 software]# cd spark-2.1.0-bin-hadoop2.7/conf/
[root@hadoop0 conf]# cp spark-env.sh.template spark-env.sh
[root@hadoop0 conf]# vi spark-env.sh
# 将下边三行添加到spark-env.sh的末尾
export JAVA_HOME=/software/jdk
export SPARK_MASTER_HOST=hadoop0
export SPARK_MASTER_PORT=7077
4. 改名并配置从节点信息文件 slaves
[root@hadoop0 conf]# cp slaves.template slaves
[root@hadoop0 conf]# vi slaves
# 将最后的localhost,添加下边两行
hadoop1
hadoop2
5. 把安装配置好的主节点的Spark目录文件复制到两个从节点
[root@hadoop0 software]# scp -r spark-2.1.0-bin-hadoop2.7 root@hadoop1:/software/
[root@hadoop0 software]# scp -r spark-2.1.0-bin-hadoop2.7 root@hadoop2:/software/
6. 配置完成,在主节点上启动
[root@hadoop0 spark-2.1.0-bin-hadoop2.7]# sbin/start-all.sh
org.apache.spark.deploy.master.Master running as process 1348. Stop it first.
hadoop2: org.apache.spark.deploy.worker.Worker running as process 1278. Stop it first.
hadoop1: org.apache.spark.deploy.worker.Worker running as process 1295. Stop it first.
7. 网页上观察:172.16.15.100:8080
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。