码迷,mamicode.com
首页 > 其他好文 > 详细

SPARK 2.2.1 YARN安装部署

时间:2018-02-23 14:42:51      阅读:533      评论:0      收藏:0      [点我收藏+]

标签:dfs   pos   pac   --   usr   pat   mem   oca   submit   

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安装部署

标签:dfs   pos   pac   --   usr   pat   mem   oca   submit   

原文地址:https://www.cnblogs.com/weidafei/p/8461758.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!