Step 1:
可以尝试先搭建HA模式,然后Yarn模式只是在这个基础上做了一些修改而已
http://blog.csdn.net/ymf827311945/article/details/73822832
Step 2:
在node11节点上执行命令:
vi ~/.bash_profile
source ~/.bash_profile
添加如下属性:
export HADOOP_INSTALL=/opt/apps/hadoop/hadoop-2.6.0
Step 3:
在node11节点上执行命令
vi /opt/apps/spark/spark-1.6.0-bin-hadoop2.6/conf/spark-env.sh
添加如下属性:
export HADOOP_CONF_DIR=$HADOOP_INSTALL/etc/hadoop
export YARN_CONF_DIR=$HADOOP_INSTALL/etc/hadoop
export SPARK_HOME=/opt/apps/spark/spark-1.6.0-bin-hadoop2.6
export SPARK_JAR=/opt/apps/spark/spark-1.6.0-bin-hadoop2.6/lib/spark-assembly-1.6.0-hadoop2.6.0.jar
export PATH=$SPARK_HOME/bin:$PATH
Step 4:
在node11节点上执行命令,进行文件的分发
scp -r /opt/apps/spark/spark-1.6.0-bin-hadoop2.6/conf/spark-env.sh node12:/opt/apps/spark/spark-1.6.0-bin-hadoop2.6/conf/
scp -r /opt/apps/spark/spark-1.6.0-bin-hadoop2.6/conf/spark-env.sh node13:/opt/apps/spark/spark-1.6.0-bin-hadoop2.6/conf/
Step 5:
在node12节点上执行命令,修改文件:
vi /opt/apps/spark/spark-1.6.0-bin-hadoop2.6/conf/spark-env.sh
将下面的属性注释:
#export SPARK_MASTER_IP=node11
Step 6:
分别在三个节点执行命令,启动zookeeper
zkServer.sh start
zkServer.sh status
Step 7:
在node11节点上执行命令, 启动HDFS和Yarn
start-all.sh
在node12节点上单独启动Resourcemanager
yarn-daemon.sh start resourcemanager
Step 8:
打开浏览器,输入URL进行查看——HDFS
192.168.80.11:50070
192.168.80.12:50070
打开浏览器,输入URL进行查看——Yarn
192.168.80.11:8088
192.168.80.12:8088
Step 9:
在node11节点上执行命令——启动Spark
cd /opt/apps/spark/spark-1.6.0-bin-hadoop2.6
./sbin/start-all.sh
在node12节点执行命令——启动master
cd /opt/apps/spark/spark-1.6.0-bin-hadoop2.6
./sbin/start-master.sh
Step 10:
打开浏览器,输入URL进行查看
http://192.168.80.11:8080/
http://192.168.80.12:8080/
Step 11:
Yarn集群Client模式
cd /opt/apps/spark/spark-1.6.0-bin-hadoop2.6
./bin/spark-submit --class org.apache.spark.examples.SparkPi --master yarn-client --executor-memory 1G --num-executors 1 ./lib/spark-examples-1.6.0-hadoop2.6.0.jar 100
Step 12:
打开浏览器,输入URL进行查看
http://192.168.80.11:8088/cluster/apps/RUNNING
Step 13:
查看结果:
Step 14:
Yarn集群Cluster模式
在node11节点执行命令:
cd /opt/apps/spark/spark-1.6.0-bin-hadoop2.6
./bin/spark-submit --class org.apache.spark.examples.SparkPi --master yarn-cluster --executor-memory 1G --num-executors 1 ./lib/spark-examples-1.6.0-hadoop2.6.0.jar 100
Step 15:
打开浏览器,输入URL进行查看
http://192.168.80.11:8088/cluster/apps/RUNNING
在运行一段时间后, 点击FINISHED—–找到自己刚才运行的Application,然后点击如下图中的History
然后点击如下图中的logs
然后点击如下图中的stdout : Total file length is 24 bytes.
最后就可以看到运行的结果