Skip to content

Instantly share code, notes, and snippets.

@aliostad
Created June 10, 2017 11:28
Show Gist options
  • Save aliostad/0de3467793d26ee6fd0b969c70b4c229 to your computer and use it in GitHub Desktop.
Save aliostad/0de3467793d26ee6fd0b969c70b4c229 to your computer and use it in GitHub Desktop.
How to get Spark Cluster's external IP for IP whitelisting
val client = new org.apache.http.impl.client.DefaultHttpClient()
val request = new org.apache.http.client.methods.HttpGet("http://ipinfo.io")
request.addHeader("accept", "application/json")
val response = client.execute(request)
val handler = new org.apache.http.impl.client.BasicResponseHandler()
println(handler.handleResponse(response).trim.toString)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment