開發(fā)環(huán)境
jdk1.8
Centos7
Spark2.0
Mesos 0.28 (見 messos安裝)
啟動腳本
Spark集群規(guī)劃(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,但是建議可以保存本地(每個節(jié)點都有一份)碧库,可以減少網絡數據傳輸/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節(jié)點配置完成妹卿,同步centos149儡首,centos150節(jié)點,集群搭建就完成了
測試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