5.1.2 Master启动的源码详解
Spark中各个组件是通过脚本来启动部署的,下面以脚本为入口点开始分析Master的部署。每个组件对应提供了启动的脚本,同时也会提供停止的脚本,停止脚本比较简单,在此仅分析启动脚本。
1. Master部署的启动脚本解析
首先看下Master的启动脚本./sbin/start-master.sh,内容如下:
1. # 在脚本的执行节点启动Master组件
2. # Starts the master on the machine this script is executed on.
3.
4. #如果没有设置环境变量SPARK_HOME,会根据脚本所在位置自动设置
5. if [ -z "${SPARK_HOME}" ]; then
6. export SPARK_HOME="$(cd "`dirname "$0"`"/..; pwd)"
7. fi
8.
9. # NOTE: This exact class name is matched downstream by SparkSubmit.
10. # Any changes need to be reflected there.
11. # Master 组件对应的类
12. CLASS="org.apa