diff options
author | Josh Rosen <rosenville@gmail.com> | 2013-05-25 23:38:05 -0700 |
---|---|---|
committer | Josh Rosen <rosenville@gmail.com> | 2013-05-25 23:38:05 -0700 |
commit | 3d4891d9fb9057fdd5ec03b0318c12b99e6af0af (patch) | |
tree | 63d56522426432c806ae8185ede20c8c5b3528a0 | |
parent | e8d4b6c296e7b38099e6df263d38e0f811d2a6d1 (diff) | |
parent | cda2b150412314c47c2c24883111bfc441c3a3a2 (diff) | |
download | spark-3d4891d9fb9057fdd5ec03b0318c12b99e6af0af.tar.gz spark-3d4891d9fb9057fdd5ec03b0318c12b99e6af0af.tar.bz2 spark-3d4891d9fb9057fdd5ec03b0318c12b99e6af0af.zip |
Merge pull request #621 from JoshRosen/spark-613
Use ec2-metadata in start-slave.sh to detect if running on EC2
-rwxr-xr-x | bin/start-slave.sh | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/bin/start-slave.sh b/bin/start-slave.sh index 616c76e4ee..26b5b9d462 100755 --- a/bin/start-slave.sh +++ b/bin/start-slave.sh @@ -6,7 +6,8 @@ bin=`cd "$bin"; pwd` # Set SPARK_PUBLIC_DNS so slaves can be linked in master web UI if [ "$SPARK_PUBLIC_DNS" = "" ]; then # If we appear to be running on EC2, use the public address by default: - if [[ `hostname` == *ec2.internal ]]; then + # NOTE: ec2-metadata is installed on Amazon Linux AMI. Check based on that and hostname + if command -v ec2-metadata > /dev/null || [[ `hostname` == *ec2.internal ]]; then export SPARK_PUBLIC_DNS=`wget -q -O - http://instance-data.ec2.internal/latest/meta-data/public-hostname` fi fi |