Skip to content

Instantly share code, notes, and snippets.

@shivaram
Created October 13, 2012 22:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shivaram/3886477 to your computer and use it in GitHub Desktop.
Save shivaram/3886477 to your computer and use it in GitHub Desktop.
Map internal to external hostnames on ec2 while using Mesos + Spark
#!/bin/bash
for i in `cat /root/mesos-ec2/slaves`;
do
ssh $i 'echo -n `hostname`" "; nslookup `hostname` | grep Address | grep 10';
done | awk '{print $1" "$3}' > /tmp/internal
for i in `cat /root/mesos-ec2/slaves`;
do
ssh $i "echo -n $i' '; nslookup $i | grep Address | grep 10";
done | awk '{print $1" "$3}' > /tmp/external
join /tmp/internal /tmp/external -1 2 -2 2 | awk '{print $2" "$3}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment