解压scala-2.10.4.tgz到/usr/local/scala目录下
[root@Master scala]#
pwd
/usr/local/scala
[root@Master scala]#
ls
scala-2.10.4 scala-2.10.4.tgz
解压spark-1.5.0-bin-hadoop2.6.tgz到/usr/local/spark目录下
[root@Master spark]#
pwd
/usr/local/spark
[root@Master spark]#
ls
spark-1.5.0-bin-hadoop2.6 spark-1.5.0-bin-hadoop2.6.tgz
查看环境变量
[root@Master scala]#
cat ~/.bash_profile
-
# .bash_profile
-
# Get the aliases and functions
-
if [ -f ~/.bashrc ]; then
-
. ~/.bashrc
-
fi
-
# User specific environment and startup programs
-
HADOOP_HOME=/usr/local/hadoop/hadoop-2.6.0
-
SCALA_HOME=/usr/local/scala/scala-2.10.4
-
SPARK_HOME=/usr/local/spark/spark-1.5.0-bin-hadoop2.6
-
JAVA_HOME=/opt/jdk1.7.0_79
-
CLASS_PATH=.$JAVA_HOME/lib/tools.jar
-
PATH=$PATH:$HOME/bin:$HADOOP_HOME/bin:$HADOOP_HOME/sbin:$SCALA_HOME/bin:$SPARK_HOME/bin:$JAVA_HOME/bin
-
export PATH HADOOP_HOME SPARK_HOME JAVA_HOME CLASS_PATH
修改/usr/local/spark/spark-1.5.0-bin-hadoop2.6/conf下的slaves文件
[root@Master conf]# cat slaves
修改/usr/local/spark/spark-1.5.0-bin-hadoop2.6/conf下的spark-env.sh文件
[root@Master conf]# cat spark-env.sh
-
#!/usr/bin/env bash
-
-
# This file is sourced when running various Spark programs.
-
# Copy it as spark-env.sh and edit that to configure Spark for your site.
-
-
# Options read when launching programs locally with
-
# ./bin/run-example or ./bin/spark-submit
-
# - HADOOP_CONF_DIR, to point Spark towards Hadoop configuration files
-
# - SPARK_LOCAL_IP, to set the IP address Spark binds to on this node
-
# - SPARK_PUBLIC_DNS, to set the public dns name of the driver program
-
# - SPARK_CLASSPATH, default classpath entries to append
-
-
# Options read by executors and drivers running inside the cluster
-
# - SPARK_LOCAL_IP, to set the IP address Spark binds to on this node
-
# - SPARK_PUBLIC_DNS, to set the public DNS name of the driver program
-
# - SPARK_CLASSPATH, default classpath entries to append
-
# - SPARK_LOCAL_DIRS, storage directories to use on this node for shuffle and RDD data
-
# - MESOS_NATIVE_JAVA_LIBRARY, to point to your libmesos.so if you use Mesos
-
-
# Options read in YARN client mode
-
# - HADOOP_CONF_DIR, to point Spark towards Hadoop configuration files
-
# - SPARK_EXECUTOR_INSTANCES, Number of workers to start (Default: 2)
-
# - SPARK_EXECUTOR_CORES, Number of cores for the workers (Default: 1).
-
# - SPARK_EXECUTOR_MEMORY, Memory per Worker (e.g. 1000M, 2G) (Default: 1G)
-
# - SPARK_DRIVER_MEMORY, Memory for Master (e.g. 1000M, 2G) (Default: 1G)
-
# - SPARK_YARN_APP_NAME, The name of your application (Default: Spark)
-
# - SPARK_YARN_QUEUE, The hadoop queue to use for allocation requests (Default: ?.efault?.
-
# - SPARK_YARN_DIST_FILES, Comma separated list of files to be distributed with the job.
-
# - SPARK_YARN_DIST_ARCHIVES, Comma separated list of archives to be distributed with the job.
-
-
# Options for the daemons used in the standalone deploy mode
-
# - SPARK_MASTER_IP, to bind the master to a different IP address or hostname
-
# - SPARK_MASTER_PORT / SPARK_MASTER_WEBUI_PORT, to use non-default ports for the master
-
# - SPARK_MASTER_OPTS, to set config properties only for the master (e.g. "-Dx=y")
-
# - SPARK_WORKER_CORES, to set the number of cores to use on this machine
-
# - SPARK_WORKER_MEMORY, to set how much total memory workers have to give executors (e.g. 1000m, 2g)
-
# - SPARK_WORKER_PORT / SPARK_WORKER_WEBUI_PORT, to use non-default ports for the worker
-
# - SPARK_WORKER_INSTANCES, to set the number of worker processes per node
-
# - SPARK_WORKER_DIR, to set the working directory of worker processes
-
# - SPARK_WORKER_OPTS, to set config properties only for the worker (e.g. "-Dx=y")
-
# - SPARK_DAEMON_MEMORY, to allocate to the master, worker and history server themselves (default: 1g).
-
# - SPARK_HISTORY_OPTS, to set config properties only for the history server (e.g. "-Dx=y")
-
# - SPARK_SHUFFLE_OPTS, to set config properties only for the external shuffle service (e.g. "-Dx=y")
-
# - SPARK_DAEMON_JAVA_OPTS, to set config properties for all daemons (e.g. "-Dx=y")
-
# - SPARK_PUBLIC_DNS, to set the public dns name of the master or workers
-
-
# Generic options for the daemons used in the standalone deploy mode
-
# - SPARK_CONF_DIR Alternate conf dir. (Default: ${SPARK_HOME}/conf)
-
# - SPARK_LOG_DIR Where log files are stored. (Default: ${SPARK_HOME}/logs)
-
# - SPARK_PID_DIR Where the pid file is stored. (Default: /tmp)
-
# - SPARK_IDENT_STRING A string representing this instance of spark. (Default: $USER)
-
# - SPARK_NICENESS The scheduling priority for daemons. (Default: 0)
-
export SPARK_HOME=/usr/local/scala/scala-2.10.4
export JAVA_HOME=/opt/jdk1.7.0_79
export HADOOP_HOME=/usr/local/hadoop/hadoop-2.6.0
export YARN_CONF_DIR=$HADOOP_HOME/etc/hadoop
export SPARK_JAR=/usr/local/spark/spark-1.5.0-bin-hadoop2.6/lib/spark-assembly-1.5.0-hadoop2.6.0.jar
将spark和scala文件夹远程拷贝到Slave1和Slave2节点
[root@Master local]# scp -r /usr/local/scala/ Slave1:/usr/local/
[root@Master local]# scp -r /usr/local/scala/ Slave2:/usr/local/
[root@Master local]# scp -r /usr/local/spark/ Slave1:/usr/local/
[root@Master local]# scp -r /usr/local/spark/ Slave2:/usr/local/
[root@Master sbin]# cd
/usr/local/spark/spark-1.5.0-bin-hadoop2.6/sbin
[root@Master sbin]# ./start-all.sh
starting org.apache.spark.deploy.master.Master, logging to /usr/local/spark/spark-1.5.0-bin-hadoop2.6/sbin/../logs/spark-root-org.apache.spark.deploy.master.Master-1-Master.out
Slave1: starting org.apache.spark.deploy.worker.Worker, logging to /usr/local/spark/spark-1.5.0-bin-hadoop2.6/sbin/../logs/spark-root-org.apache.spark.deploy.worker.Worker-1-Slave1.out
Slave2: starting org.apache.spark.deploy.worker.Worker, logging to /usr/local/spark/spark-1.5.0-bin-hadoop2.6/sbin/../logs/spark-root-org.apache.spark.deploy.worker.Worker-1-Slave2.out
执行命令查看状态
在Master节点执行命令
[root@Master sbin]# jps -l
9032 org.apache.hadoop.yarn.server.resourcemanager.ResourceManager
9353 org.apache.spark.deploy.master.Master
8792 org.apache.hadoop.hdfs.server.namenode.NameNode
9476 sun.tools.jps.Jps
在Slave1节点执行命令
[root@Slave1 hadoop]# jps -l
4575 org.apache.spark.deploy.worker.Worker
4643 sun.tools.jps.Jps
4394 org.apache.hadoop.yarn.server.nodemanager.NodeManager
4291 org.apache.hadoop.hdfs.server.datanode.DataNode
在Slave2节点执行命令
[root@Slave2 scala]# jps -l
27889 org.apache.hadoop.hdfs.server.datanode.DataNode
27992 org.apache.hadoop.yarn.server.nodemanager.NodeManager
28173 org.apache.spark.deploy.worker.Worker
28256 sun.tools.jps.Jps
访问spark
阅读(1242) | 评论(0) | 转发(0) |