环境:spark2.1.1
standlone模式安装:spark集群安装配置笔记(standalone模式)
1、修改conf/spark-default.conf文件(mv spark-defaults.conf.template spark-defaults.conf)如下
#open the log services
spark.eventLog.enabled true
#set the work directory of log server
spark.eventLog.dir hdfs://chdp11:9000/spark/jobHistory
2、在HDFS上创建好上述配置的目录:
hadoop fs -mkdir -p /spark/jobHistory
3、修改spark-env.sh文件,添加如下配置
#ui.port=18080:WEBUI access port 18080
#retainedApplications=30 :retain number of application in memory with recent ,overflow will be save in disk
#fs.logDirectory=hdfs://chdp11:9000/spark/jobHistory":save dirrctory of running applicaton data
export SPARK_HISTORY_OPTS="
-Dspark.history.ui.port=18080
-Dspark.history.retainedApplications=30
-Dspark.history.fs.logDirectory=hdfs://chdp11:9000/spark/jobHistory"
4、分发配置文件
transFilesToAll.sh conf/spark-default.conf
5、启动历史服务
sbin/start-history-server.sh
6、执行官方求PI案例
bin/spark-submit \
--master spark://chdp11:7077 \
--class org.apache.spark.examples.SparkPi \
--executor-memory 1G \
--total-executor-cores 4 \
./examples/jars/spark-examples_2.11-2.1.1.jar \
100
7、查看历史服务
chdp11:18080