kwu --- Spark配置文件详解
1、主要环境配置文件 spark-env.sh
- export JAVA_HOME=/usr/java/jdk1.7.0_67-cloudera
- export SPARK_MASTER_IP=10.130.2.20 #1
- export SPARK_MASTER_PORT=7077
- export SPARK_WORKER_CORES=24
- export SPARK_EXECUTOR_INSTANCES=1
- export SPARK_WORKER_MEMORY=48g
- export HADOOP_HOME=/opt/cloudera/parcels/CDH/lib/hadoop
- export HADOOP_CONF_DIR=/etc/hadoop/conf/
- export SPARK_DAEMON_MEMORY=8G
- #export SPARK_DAEMON_JAVA_OPTS="-Dspark.deploy.recoveryMode=ZOOKEEPER -Dspark.deploy.zookeeper.url=bdc40.hexun.com:2181,bdc41.hexun.com:2181,bdc46.hexun.com:2181,bdc53.hexun.com:2181,bdc54.hexun.com:2181 -Dspark.deploy.zookeeper.dir=/spark" #2
- #export SPARK_DAEMON_JAVA_OPTS="-Dspark.deploy.recoveryMode=FILESYSTEM -Dspark.deploy.recoveryDirectory=/opt/modules/spark/recovery" #3
- export JAVA_LIBRARY_PATH=$JAVA_LIBRARY_PATH:$HADOOP_HOME/lib/native
- export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HADOOP_HOME/lib/native
- export SPARK_LIBRARY_PATH=$SPARK_LIBRARY_PATH:$HADOOP_HOME/lib/native
- export SPARK_CLASSPATH=$SPARK_CLASSPATH:$HADOOP_HOME/lib/snappy-java-1.0.4.1.jar
说明 :
1) 单结点无容错的 standalone模式
2) 基于zookeeper的master的HA模式,故障自动切换
3) 基于文件系统的容错模式,故障后需手动重启
2、 基本配置文件 spark-defaults.conf
- spark.local.dir /diskb/sparktmp,/diskc/sparktmp,/diskd/sparktmp,/diske/sparktmp,/diskf/sparktmp,/diskg/sparktmp
- spark.eventLog.enabled true
- spark.eventLog.dir hdfs://nameservice1/spark-log
1) 配置本地日志文件
2) 配置基于HDFS的历史日志文件储存
3、从节点的配置 slaves
- spark1
- spark2
- spark3
说明:给定slave节点相应的主机名