Skip to content
Snippets Groups Projects
Commit 3d4891d9 authored by Josh Rosen's avatar Josh Rosen
Browse files

Merge pull request #621 from JoshRosen/spark-613

Use ec2-metadata in start-slave.sh to detect if running on EC2
parents e8d4b6c2 cda2b150
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment