开发环境
jdk1.8
Centos7
Spark2.0
Mesos 0.28 (见 messos安装)
启动脚本
Spark集群规划(centos148,centos149,centos150)
Spark集群配置
centos148设置如下(centos149,centos150相同)
/conf/spark-env.sh
export SPARK_LOCAL_DIRS=/home/data/spark
export MESOS_NATIVE_JAVA_LIBRARY=/usr/local/lib/libmesos.so
export SPARK_EXECUTOR_URI=/home/testjar/spark-2.0.2-bin-hadoop2.6.tgz
SPARK_LOCAL_DIRS
:保存spark相关数据MESOS_NATIVE_JAVA_LIBRARY
:mesos.so库SPARK_EXECUTOR_URI
:spark配置完后,打包为jar,传递的目录,可以是HDFS,Http,但是建议可以保存本地(每个节点都有一份),可以减少网络数据传输/conf/spark-defaults.conf
spark.master mesos://zk://centos7_148:2181,centos7_149,centos7_150/mesos
spark.eventLog.enabled true
spark.eventLog.dir /home/data/spark
spark.executor.memory 2g
spark.mesos.mesosExecutor.cores 2
spark.master
也可以设置在spark-env.sh
(设置方法,读者可以自行查阅)/conf/slaves
centos7_147
centos7_148
centos7_150
- 以上centos148节点配置完成,同步centos149,centos150节点,集群搭建就完成了
测试Spark集群
- mesos centos148,centos149分别为主备master(如下图)
./bin/spark-shell --master mesos://zk://centos_148:2181,centos_149:2181,centos7_150:2181/mesos
启动脚本
start-mesos-dispatcher.sh --master mesos://node1:5050 -z node1:2181,node2:2181,node3:2181