You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by be...@apache.org on 2011/06/05 10:24:18 UTC
svn commit: r1132014 - in /incubator/mesos/trunk/src: Makefile.in
deploy/mesos-env.sh deploy/start-master deploy/start-masters
deploy/start-mesos deploy/start-slaves deploy/stop-master
deploy/stop-masters deploy/stop-mesos
Author: benh
Date: Sun Jun 5 08:24:18 2011
New Revision: 1132014
URL: http://svn.apache.org/viewvc?rev=1132014&view=rev
Log:
Added support for launching multiple masters in deploy scripts.
Added:
incubator/mesos/trunk/src/deploy/start-masters (with props)
incubator/mesos/trunk/src/deploy/stop-masters (with props)
Removed:
incubator/mesos/trunk/src/deploy/start-master
incubator/mesos/trunk/src/deploy/stop-master
Modified:
incubator/mesos/trunk/src/Makefile.in
incubator/mesos/trunk/src/deploy/mesos-env.sh
incubator/mesos/trunk/src/deploy/start-mesos
incubator/mesos/trunk/src/deploy/start-slaves
incubator/mesos/trunk/src/deploy/stop-mesos
Modified: incubator/mesos/trunk/src/Makefile.in
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/Makefile.in?rev=1132014&r1=1132013&r2=1132014&view=diff
==============================================================================
--- incubator/mesos/trunk/src/Makefile.in (original)
+++ incubator/mesos/trunk/src/Makefile.in Sun Jun 5 08:24:18 2011
@@ -207,10 +207,10 @@ CONF_FILES = $(CONFDIR)/mesos.conf
DEPLOY_FILES = $(DEPLOYDIR)/deploy-to-slaves \
$(DEPLOYDIR)/mesos-daemon \
$(DEPLOYDIR)/mesos-env.sh \
- $(DEPLOYDIR)/start-master \
+ $(DEPLOYDIR)/start-masters \
$(DEPLOYDIR)/start-mesos \
$(DEPLOYDIR)/start-slaves \
- $(DEPLOYDIR)/stop-master \
+ $(DEPLOYDIR)/stop-masters \
$(DEPLOYDIR)/stop-mesos \
$(DEPLOYDIR)/stop-slaves \
Modified: incubator/mesos/trunk/src/deploy/mesos-env.sh
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/deploy/mesos-env.sh?rev=1132014&r1=1132013&r2=1132014&view=diff
==============================================================================
--- incubator/mesos/trunk/src/deploy/mesos-env.sh (original)
+++ incubator/mesos/trunk/src/deploy/mesos-env.sh Sun Jun 5 08:24:18 2011
@@ -6,12 +6,12 @@ DEPLOY_DIR=`cd "$DEPLOY_DIR"; pwd`
# Locate MESOS_HOME relative to deploy directory
MESOS_HOME=`cd "$DEPLOY_DIR/.."; pwd`
-# Find files that list master and slaves
-MASTER_FILE="$MESOS_HOME/conf/master"
-if [ -e "$MASTER_FILE" ]; then
- MASTER=`cat "$MASTER_FILE"`
+# Find files that list masters and slaves
+MASTERS_FILE="$MESOS_HOME/conf/masters"
+if [ -e "$MASTERS_FILE" ]; then
+ MASTERS=`cat "$MASTERS_FILE"`
else
- echo "Error: $MASTER_FILE does not exist" >&2
+ echo "Error: $MASTERS_FILE does not exist" >&2
exit 1
fi
SLAVES_FILE="$MESOS_HOME/conf/slaves"
@@ -22,6 +22,15 @@ else
exit 1
fi
+# Find Mesos URL to use; first look to see if url is set in
+# the Mesos config file, and if it isn't, use 1@MASTER:5050
+# (taking the first master in the masters file)
+MESOS_URL=`$MESOS_HOME/bin/mesos-getconf url`
+if [ "x$MESOS_URL" == "x" ]; then
+ FIRST_MASTER=`head -1 "$MASTERS_FILE"`
+ MESOS_URL="mesos://1@$FIRST_MASTER:5050"
+fi
+
# Options for SSH
SSH_OPTS="-o StrictHostKeyChecking=no -o ConnectTimeout=2"
Added: incubator/mesos/trunk/src/deploy/start-masters
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/deploy/start-masters?rev=1132014&view=auto
==============================================================================
--- incubator/mesos/trunk/src/deploy/start-masters (added)
+++ incubator/mesos/trunk/src/deploy/start-masters Sun Jun 5 08:24:18 2011
@@ -0,0 +1,23 @@
+#!/usr/bin/env bash
+DEPLOY_DIR=`dirname "$0"`
+DEPLOY_DIR=`cd "$DEPLOY_DIR"; pwd`
+
+. $DEPLOY_DIR/mesos-env.sh
+
+cd $DEPLOY_DIR
+
+# Only pass the URL param to the master if we are using ZooKeeper,
+# because otherwise master_detector doesn't know what to do with it.
+URL_PARAM=""
+if [[ "$MESOS_URL" == zoo://* || "$MESOS_URL" == "zoofile://*" ]]; then
+ URL_PARAM="-u '$MESOS_URL'"
+fi
+
+# Launch masters
+for master in $MASTERS; do
+ echo "Starting master on $master"
+ echo ssh $SSH_OPTS $master "$DEPLOY_DIR/mesos-daemon mesos-master $URL_PARAM </dev/null >/dev/null"
+ ssh $SSH_OPTS $master "$DEPLOY_DIR/mesos-daemon mesos-master $URL_PARAM </dev/null >/dev/null" &
+ sleep 0.1
+done
+wait
Propchange: incubator/mesos/trunk/src/deploy/start-masters
------------------------------------------------------------------------------
svn:executable = *
Modified: incubator/mesos/trunk/src/deploy/start-mesos
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/deploy/start-mesos?rev=1132014&r1=1132013&r2=1132014&view=diff
==============================================================================
--- incubator/mesos/trunk/src/deploy/start-mesos (original)
+++ incubator/mesos/trunk/src/deploy/start-mesos Sun Jun 5 08:24:18 2011
@@ -4,7 +4,7 @@ DEPLOY_DIR=`cd "$DEPLOY_DIR"; pwd`
. $DEPLOY_DIR/mesos-env.sh
-$DEPLOY_DIR/start-master
+$DEPLOY_DIR/start-masters
$DEPLOY_DIR/start-slaves
Modified: incubator/mesos/trunk/src/deploy/start-slaves
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/deploy/start-slaves?rev=1132014&r1=1132013&r2=1132014&view=diff
==============================================================================
--- incubator/mesos/trunk/src/deploy/start-slaves (original)
+++ incubator/mesos/trunk/src/deploy/start-slaves Sun Jun 5 08:24:18 2011
@@ -5,12 +5,11 @@ DEPLOY_DIR=`cd "$DEPLOY_DIR"; pwd`
cd $DEPLOY_DIR
-#PORT=`../src/get_conf port $@`;
-#Launch slaves
+# Launch slaves
for slave in $SLAVES; do
echo "Starting slave on $slave"
- echo ssh $SSH_OPTS $slave "$DEPLOY_DIR/mesos-daemon mesos-slave -u 1@$MASTER:5050 </dev/null >/dev/null"
- ssh $SSH_OPTS $slave "$DEPLOY_DIR/mesos-daemon mesos-slave -u 1@$MASTER:5050 </dev/null >/dev/null" &
+ echo ssh $SSH_OPTS $slave "$DEPLOY_DIR/mesos-daemon mesos-slave -u $MESOS_URL </dev/null >/dev/null"
+ ssh $SSH_OPTS $slave "$DEPLOY_DIR/mesos-daemon mesos-slave -u $MESOS_URL </dev/null >/dev/null" &
sleep 0.1
done
wait
Added: incubator/mesos/trunk/src/deploy/stop-masters
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/deploy/stop-masters?rev=1132014&view=auto
==============================================================================
--- incubator/mesos/trunk/src/deploy/stop-masters (added)
+++ incubator/mesos/trunk/src/deploy/stop-masters Sun Jun 5 08:24:18 2011
@@ -0,0 +1,14 @@
+#!/usr/bin/env bash
+DEPLOY_DIR=`dirname "$0"`
+DEPLOY_DIR=`cd "$DEPLOY_DIR"; pwd`
+
+. $DEPLOY_DIR/mesos-env.sh
+
+cd $DEPLOY_DIR
+
+for master in $MASTERS; do
+ echo "Stopping master on $master"
+ ssh $SSH_OPTS $master "killall mesos-master" &
+ sleep 0.1
+done
+wait
Propchange: incubator/mesos/trunk/src/deploy/stop-masters
------------------------------------------------------------------------------
svn:executable = *
Modified: incubator/mesos/trunk/src/deploy/stop-mesos
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/deploy/stop-mesos?rev=1132014&r1=1132013&r2=1132014&view=diff
==============================================================================
--- incubator/mesos/trunk/src/deploy/stop-mesos (original)
+++ incubator/mesos/trunk/src/deploy/stop-mesos Sun Jun 5 08:24:18 2011
@@ -8,4 +8,4 @@ cd $DEPLOY_DIR
./stop-slaves
sleep 1
-./stop-master
+./stop-masters