spark-1.6.0分布式环境搭建详细过程

本文档的前提是:hadoop的yarn正在运行。


组网:3台centos 6.5

vm1(master)、vm2(slave1)、vm3(slave2)


软件:

scala-2.11.4.tar.gz

spark-1.6.0-bin-hadoop2.6


一:准备工作

1、拷贝scala-2.11.4.tar.gz、spark-1.6.0-bin-hadoop2.6到/usr/local

2、配置环境变量vim /etc/profile

export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL
export JAVA_HOME=/usr/local/java/jdk1.7.0_79
export SCALA_HOME=/usr/local/scala-2.11.4
export HADOOP_HOME=/usr/local/hadoop-2.6.0
export SPARK_HOME=/usr/local/spark-1.6.0-bin-hadoop2.6
export PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$HADOOP_HOME/bin:${SCALA_HOME}/bin:${SPARK_HOME}/bin

export CLASSPATH=.:/usr/local/java/jdk1.7.0_79/lib:/usr/local/java/jdk1.7.0_79/jre/lib:$CLASSPATH

3、验证scala

[rootk@vm1 scala]$ scala -version
Scala code runner version 2.11.4 -- Copyright 2002-2013, LAMP/EPFL

[root@vm1 scala]$ scala
Welcome to Scala version 2.11.4 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_37).
Type in expressions to have them evaluated.
Type :help for more information.

scala> var str = "SB is"+"SB"
str: String = SB isSB


二:spark配置修改

1、获得配置文件

cd /usr/local/spark-1.6.0/conf/

cp spark-env.sh.template spark-env.sh

cp slaves.template slaves

2、修改配置文件slaves

vim slaves

添加内容:

vm1

vm2

vm3

3、修改配置文件spark-env.sh

export JAVA_HOME=/usr/local/java/jdk1.7.0_79
export SCALA_HOME=/usr/local/scala-2.11.4
export SPARK_MASTER_IP=6.6.6.6
export SPARK_WORKER_MEMORY=1g
export HADOOP_CONF_DIR=/usr/local/hadoop-2.6.0/etc/hadoop

HADOOP_CONF_DIR是Hadoop配置文件目录,SPARK_MASTER_IP主机IP地址,SPARK_WORKER_MEMORY是worker使用的最大内存


三:拷贝scala、spark到vm2、vm3


四:启动

./sbin/start-all.sh

jps查看进程


你可能感兴趣的:(spark-1.6.0分布式环境搭建详细过程)