add two scripts for starting and stoping spark, should run update-basefs.sh to update

This commit is contained in:
Donggang Cao 2016-04-11 10:31:05 -04:00
parent 6963dd836d
commit 60db552245
3 changed files with 50 additions and 0 deletions

22
tools/dl_start_spark.sh Executable file
View File

@ -0,0 +1,22 @@
#!/bin/sh
# a naive script to fast start spark cluster, assuming host-0 master,
# others slaves.
# used with dl_stop_spark.sh
SPARK_HOME=/home/spark
HOSTS=`grep -v localhost /etc/hosts | awk '{print $2}'`
echo "Starting master in host-0"
$SPARK_HOME/sbin/start-master.sh
for h in $HOSTS ; do
echo "Starting slave in $h"
if [ $h != 'host-0' ] ; then
ssh root@$h /home/spark/sbin/start-slave.sh spark://host-0:7077
else
/home/spark/sbin/start-slave.sh spark://host-0:7077
fi
done

23
tools/dl_stop_spark.sh Executable file
View File

@ -0,0 +1,23 @@
#!/bin/sh
# a naive script to stop spark cluster, assuming host-0 master
# others slaves
# used with dl_start_spark.sh
SPARK_HOME=/home/spark
HOSTS=`grep -v localhost /etc/hosts | awk '{print $2}'`
for h in $HOSTS ; do
echo "Stopping slave in $h"
if [ $h != 'host-0' ] ; then
ssh root@$h /home/spark/sbin/stop-slave.sh
else
/home/spark/sbin/stop-slave.sh
fi
done
echo "Stopping master in host-0"
$SPARK_HOME/sbin/stop-master.sh

View File

@ -119,3 +119,8 @@ Host *
UserKnownHostsFile=/dev/null
EOF
done
echo "[*] Generating $BASEFS/home/spark/sbin/dl_{start|stop}_spark.sh for Spark"
if [ -d $BASEFS/home/spark/sbin ] ; then
cp dl_*_spark.sh $BASEFS/home/spark/sbin
fi