SPARK 2.2.1 YARN安装部署

Posted weidafei

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了SPARK 2.2.1 YARN安装部署相关的知识,希望对你有一定的参考价值。

1、安装scala:

在SparkNode01~03节点安装:

cd /opt

tar xzvf scala-2.11.12.tgz

mv scala-2.11.12 scala

scp -r scala @SparkNode03:/opt

vi /etc/profile

SCALA_HOME=/opt/scala

PATH=$PATH:$SCALA_HOME/bin

source /etc/profile 

scala -version

2、安装Spark

在SparkNode01~03节点安装:

cd /opt

tar xzvf spark-2.2.1-bin-hadoop2.7.tgz

mv spark-2.2.1-bin-hadoop2.7 spark

cd spark/conf

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

vi spark-env.sh

添加:

export JAVA_HOME=/usr/local/java/jdk1.8.0_121

export SCALA_HOME=/opt/scala

export HADOOP_HOME=/opt/hadoop

export HADOOP_CONF_DIR=/opt/hadoop/tc/hadoop

export SPARK_MASTER_PORT=7077

export SPARK_EXECUTOR_CORES=2

export SPARK_EXECUTOR_MEMORY=1024m

export SPARK_EXECUTOR_INSTANCES=1

 

cp slaves.template slaves

vi slaves

添加:

SparkNode01

SparkNode02

SparkNode03

 

在hdfs上传spark的jar包,并修改/opt/spark/conf/spark-defaults.conf

cd /opt/hadoop/bin

./hadoop fs -mkdir /spark_jars

./hadoop fs -put  /opt/spark/jars/* /spark_jars

cp spark-defaults.conf.template spark-defaults.conf

vi spark-defaults.conf

添加:

spark.yarn.jars=hdfs://Master01:9000/spark_jars/*

 

验证:

./spark-submit --class org.apache.spark.examples.SparkPi --master yarn --deploy-mode cluster --driver-memory 1g --executor-memory 1g --executor-cores 1 --num-executors 3 /opt/spark/examples/jars/spark-examples_2.11-2.2.1.jar 10

以上是关于SPARK 2.2.1 YARN安装部署的主要内容,如果未能解决你的问题,请参考以下文章

Spark Yarn模式部署

Spark On YARN 分布式集群安装

Spark HA on yarn 最简易安装。

spark2.10安装部署(集成hadoop2.7+)

SparkSpark的Standalone模式安装部署

如何在windows安装部署spark 求大神们的告知