配置Spark standalone HA 主機:node1,node2,node3 master: node1,node2 slave:node2,node3 修改配置文件: node1,node3: spark-env.sh node2: spark-env.sh node2與node1的差別僅 ...
配置Spark standalone HA
主機:node1,node2,node3
master: node1,node2
slave:node2,node3
修改配置文件:
node1,node3: spark-env.sh
export SPARK_MASTER_IP=node1 export SPARK_MASTER_PORT=7077 export SPARK_WORKER_CORES=1 export SPARK_WORKER_INSTANCES=1 export SPARK_WORKER_MEMORY=1024m export SPARK_LOCAL_DIRS=/data/spark/dataDir export SPARK_DAEMON_JAVA_OPTS="-Dspark.deploy.recoveryMode=ZOOKEEPER -Dspark.deploy.zookeeper.url=node1:2181,node2:2181,node3:2181 -Dspark.deploy.zookeeper.dir=/sparkHA"
node2: spark-env.sh
export SPARK_MASTER_IP=node2
node2與node1的差別僅在此
啟動腳本:
ZooKeeper已經啟動完畢,這裡沒有說明ZooKeeper的配置和啟動。
spark啟動腳本
node1:
/sbin/start-all.sh
node2:
/sbin/start-master.sh
測試HA
停掉node1 master
/sbin/stop-master.sh
訪問node2的master
沒有停掉node1的master,訪問node2
停掉node1的master之後,訪問node2