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:37:49 UTC
svn commit: r1132073 - in /incubator/mesos/trunk/ec2:
deploy.lucid64/root/mesos-ec2/setup
deploy.lucid64/root/mesos-ec2/setup-slave mesos_ec2.py
Author: benh
Date: Sun Jun 5 08:37:49 2011
New Revision: 1132073
URL: http://svn.apache.org/viewvc?rev=1132073&view=rev
Log:
More work on EBS-backed instances: fixed bugs with how NFS was being
mounted which were due to stopped instances using their old hostname
once they are started up (EC2 actually gives them a new name).
Modified:
incubator/mesos/trunk/ec2/deploy.lucid64/root/mesos-ec2/setup
incubator/mesos/trunk/ec2/deploy.lucid64/root/mesos-ec2/setup-slave
incubator/mesos/trunk/ec2/mesos_ec2.py
Modified: incubator/mesos/trunk/ec2/deploy.lucid64/root/mesos-ec2/setup
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/ec2/deploy.lucid64/root/mesos-ec2/setup?rev=1132073&r1=1132072&r2=1132073&view=diff
==============================================================================
--- incubator/mesos/trunk/ec2/deploy.lucid64/root/mesos-ec2/setup (original)
+++ incubator/mesos/trunk/ec2/deploy.lucid64/root/mesos-ec2/setup Sun Jun 5 08:37:49 2011
@@ -3,13 +3,20 @@
# Make sure we are in the mesos-ec2 directory
cd /root/mesos-ec2
+# Set hostname based on EC2 private DNS name, so that it is set correctly
+# even if the instance is restarted with a different private DNS name
+PRIVATE_DNS=`wget -q -O - http://instance-data.ec2.internal/latest/meta-data/local-hostname`
+hostname $PRIVATE_DNS
+echo $PRIVATE_DNS > /etc/hostname
+HOSTNAME=$PRIVATE_DNS # Fix the bash built-in hostname variable too
+
+echo "Setting up Mesos master on `hostname`..."
+
+# Read command-line arguments
OS_NAME=$1
DOWNLOAD_METHOD=$2
BRANCH=$3
-# By exporting this git won't ask to accept a key.
-export GIT_SSH=/root/mesos-ec2/ssh-no-keychecking
-
MASTERS_FILE="masters"
MASTERS=`cat $MASTERS_FILE`
NUM_MASTERS=`cat $MASTERS_FILE | wc -l`
@@ -45,10 +52,6 @@ if [[ `tty` == "not a tty" ]] ; then
exit 1
fi
-echo "Setting up Mesos master on `hostname`..."
-
-cd /root/mesos-ec2
-
echo "Setting executable permissions on scripts..."
for s in $SCRIPTS; do chmod u+x $s; done
@@ -62,7 +65,7 @@ done
ssh -q $SSH_OPTS localhost echo -n &
if [[ $NUM_ZOOS != 0 ]] ; then
- echo "SSH'ing to Zoo server(s) to approve keys..."
+ echo "SSH'ing to ZooKeeper server(s) to approve keys..."
zid=1
for zoo in $ZOO; do
echo $zoo
@@ -92,7 +95,7 @@ if [[ $NUM_MASTERS -gt 1 ]] ; then
fi
if [[ $NUM_ZOOS != 0 ]] ; then
- echo "RSYNC'ing /root/mesos-ec2 to other Zoo servers..."
+ echo "RSYNC'ing /root/mesos-ec2 to other ZooKeeper servers..."
for zoo in $ZOOS; do
echo $zoo
rsync -e "ssh $SSH_OPTS" -az /root/mesos-ec2 $zoo:/root & sleep 0.3
@@ -137,6 +140,8 @@ wait
DOWNLOADED=0
if [[ "$DOWNLOAD_METHOD" == "git" ]] ; then
+ # change git's ssh command so it does not ask to accept a keys
+ export GIT_SSH=/root/mesos-ec2/ssh-no-keychecking
REPOSITORY=git://github.com/mesos/mesos.git
echo "Checking out Mesos from $REPOSITORY"
pushd /root > /dev/null 2>&1
@@ -186,15 +191,20 @@ echo "Redeploying /root/mesos..."
./redeploy-mesos
echo "Setting up NFS..."
-if [ ! -e /mnt/nfs ] ; then
+if [ ! -e /nfs ] ; then
mkdir -p /mnt/nfs
rm -fr /nfs
ln -s /mnt/nfs /nfs
- if ! grep -e '/nfs' /etc/exports; then
- echo "/nfs 10.0.0.0/8(ro,async,no_subtree_check)" >> /etc/exports
- fi
- exportfs -a
fi
+if ! grep -e '^/nfs ' /etc/exports; then
+ echo "/nfs 10.0.0.0/8(ro,async,no_subtree_check)" >> /etc/exports
+fi
+# Unexport and re-export everything in /etc/exports because, if we are
+# restarting a stopped EC2 instance, we might have had an entry for /nfs in
+# /etc/exports before we created /mnt/nfs.
+exportfs -ua
+exportfs -a
+
echo "Mounting NFS on slaves..."
for slave in $SLAVES; do
echo $slave
Modified: incubator/mesos/trunk/ec2/deploy.lucid64/root/mesos-ec2/setup-slave
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/ec2/deploy.lucid64/root/mesos-ec2/setup-slave?rev=1132073&r1=1132072&r2=1132073&view=diff
==============================================================================
--- incubator/mesos/trunk/ec2/deploy.lucid64/root/mesos-ec2/setup-slave (original)
+++ incubator/mesos/trunk/ec2/deploy.lucid64/root/mesos-ec2/setup-slave Sun Jun 5 08:37:49 2011
@@ -1,5 +1,15 @@
#!/bin/bash
+# Make sure we are in the mesos-ec2 directory
+cd /root/mesos-ec2
+
+# Set hostname based on EC2 private DNS name, so that it is set correctly
+# even if the instance is restarted with a different private DNS name
+PRIVATE_DNS=`wget -q -O - http://instance-data.ec2.internal/latest/meta-data/local-hostname`
+hostname $PRIVATE_DNS
+echo $PRIVATE_DNS > /etc/hostname
+HOSTNAME=$PRIVATE_DNS # Fix the bash built-in hostname variable too
+
echo "Setting up Mesos slave on `hostname`..."
# Mount options to use for ext3 and xfs disks (the ephemeral disks
Modified: incubator/mesos/trunk/ec2/mesos_ec2.py
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/ec2/mesos_ec2.py?rev=1132073&r1=1132072&r2=1132073&view=diff
==============================================================================
--- incubator/mesos/trunk/ec2/mesos_ec2.py (original)
+++ incubator/mesos/trunk/ec2/mesos_ec2.py Sun Jun 5 08:37:49 2011
@@ -53,7 +53,8 @@ def parse_args():
"Greater values cause Mesos to run in FT mode with ZooKeeper.")
parser.add_option("--ebs-vol-size", metavar="SIZE", type="int", default=0,
help="Attach a new EBS volume of size SIZE (in GB) to each node as " +
- "/vol. The volumes will be deleted when the instances terminate.")
+ "/vol. The volumes will be deleted when the instances terminate. " +
+ "Only possible on EBS-backed AMIs.")
(opts, args) = parser.parse_args()
opts.ft = int(opts.ft)
if len(args) != 2:
@@ -366,8 +367,8 @@ def main():
elif action == "stop":
response = raw_input("Are you sure you want to stop the cluster " +
cluster_name + "?\nDATA ON EPHEMERAL DISKS WILL BE LOST, " +
- "BUT THE CLUSTER WILL KEEP USING SPACE ON EBS IF IT IS " +
- "EBS-BACKED!\n" +
+ "BUT THE CLUSTER WILL KEEP USING SPACE ON\n" +
+ "AMAZON EBS IF IT IS EBS-BACKED!\n" +
"Stop cluster " + cluster_name + " (y/N): ")
if response == "y":
(master_res, slave_res, zoo_res) = get_existing_cluster(conn, opts, cluster_name)