aboutsummaryrefslogtreecommitdiff
path: root/bin/start-slaves.sh
diff options
context:
space:
mode:
authorReynold Xin <rxin@cs.berkeley.edu>2012-10-19 01:08:23 -0700
committerReynold Xin <rxin@cs.berkeley.edu>2012-10-19 01:08:23 -0700
commitf67bcbed07bbfc79d162b16f65c351999927ac0a (patch)
tree87d2a6451dc23fd804f789cc162ba1bc7248402f /bin/start-slaves.sh
parent63fe4e9d33ec59d93b42507ca9ea286178c12ec4 (diff)
downloadspark-f67bcbed07bbfc79d162b16f65c351999927ac0a.tar.gz
spark-f67bcbed07bbfc79d162b16f65c351999927ac0a.tar.bz2
spark-f67bcbed07bbfc79d162b16f65c351999927ac0a.zip
Use SPARK_MASTER_IP if it is set in start-slaves.sh.
Diffstat (limited to 'bin/start-slaves.sh')
-rwxr-xr-xbin/start-slaves.sh18
1 files changed, 16 insertions, 2 deletions
diff --git a/bin/start-slaves.sh b/bin/start-slaves.sh
index f348ea063f..74b70a24be 100755
--- a/bin/start-slaves.sh
+++ b/bin/start-slaves.sh
@@ -14,7 +14,21 @@ if [ "$SPARK_MASTER_PORT" = "" ]; then
SPARK_MASTER_PORT=7077
fi
-hostname=`hostname`
-ip=`host "$hostname" | cut -d " " -f 4`
+if [ "$SPARK_MASTER_IP" = "" ]; then
+ hostname=`hostname`
+ hostouput=`host "$hostname"`
+
+ if [[ "$hostouput" == *"not found"* ]]; then
+ echo $hostouput
+ echo "Fail to identiy the IP for the master."
+ echo "Set SPARK_MASTER_IP explicitly in configuration instead."
+ exit 1
+ fi
+ ip=`host "$hostname" | cut -d " " -f 4`
+else
+ ip=$SPARK_MASTER_IP
+fi
+
+echo "Master IP: $ip"
"$bin"/spark-daemons.sh start spark.deploy.worker.Worker spark://$ip:$SPARK_MASTER_PORT \ No newline at end of file