Skip to content

Commit

Permalink
approve keys twice
Browse files Browse the repository at this point in the history
  • Loading branch information
nchammas committed Nov 17, 2014
1 parent e2d9d8c commit 1d7270a
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ source /root/.bash_profile
# Load the cluster variables set by the deploy script
source ec2-variables.sh

function approve_ssh_keys () {
pssh --inline \
--host "localhost $(hostname) $MASTERS $SLAVES" \
--user root \
--extra-args "$SSH_OPTS" \
":"
}

# 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`
Expand Down Expand Up @@ -45,11 +53,7 @@ echo "Setting executable permissions on scripts..."
find . -regex "^.+.\(sh\|py\)" | xargs chmod a+x

echo "SSH-ing to all cluster nodes to approve keys..."
pssh --inline \
--host "localhost $(hostname) $MASTERS $SLAVES" \
--user root \
--extra-args "$SSH_OPTS" \
":"
approve_ssh_keys

echo "RSYNC'ing /root/spark-ec2 to other cluster nodes..."
for node in $SLAVES $OTHER_MASTERS; do
Expand All @@ -67,6 +71,9 @@ pssh --inline \
--extra-args "-t -t $SSH_OPTS" \
"spark-ec2/setup-slave.sh"

echo "SSH-ing to all cluster nodes to re-approve keys..."
# We do this again because setup-slave.sh clears out .ssh/known_hosts.
approve_ssh_keys

# Always include 'scala' module if it's not defined as a work around
# for older versions of the scripts.
Expand Down

0 comments on commit 1d7270a

Please sign in to comment.