Skip to content

Commit

Permalink
SPARK-1348 binding Master, Worker, and App Web UI to all interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
kanzhang committed Apr 4, 2014
1 parent 92a86b2 commit 7a8084e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class MasterWebUI(val master: Master, requestedPort: Int) extends Logging {

def bind() {
try {
serverInfo = Some(startJettyServer(host, port, handlers, master.conf))
serverInfo = Some(startJettyServer("0.0.0.0", port, handlers, master.conf))
logInfo("Started Master web UI at http://%s:%d".format(host, boundPort))
} catch {
case e: Exception =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class WorkerWebUI(val worker: Worker, val workDir: File, requestedPort: Option[I

def bind() {
try {
serverInfo = Some(JettyUtils.startJettyServer(host, port, handlers, worker.conf))
serverInfo = Some(JettyUtils.startJettyServer("0.0.0.0", port, handlers, worker.conf))
logInfo("Started Worker web UI at http://%s:%d".format(host, boundPort))
} catch {
case e: Exception =>
Expand Down
5 changes: 4 additions & 1 deletion core/src/main/scala/org/apache/spark/ui/JettyUtils.scala
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,10 @@ private[spark] object JettyUtils extends Logging {

@tailrec
def connect(currentPort: Int): (Server, Int) = {
val server = new Server(new InetSocketAddress(hostName, currentPort))
val server = if ("0.0.0.0".equals(hostName))
new Server(currentPort)
else
new Server(new InetSocketAddress(hostName, currentPort))
val pool = new QueuedThreadPool
pool.setDaemon(true)
server.setThreadPool(pool)
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/scala/org/apache/spark/ui/SparkUI.scala
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ private[spark] class SparkUI(
/** Bind the HTTP server which backs this web interface */
def bind() {
try {
serverInfo = Some(startJettyServer(bindHost, port, handlers, sc.conf))
serverInfo = Some(startJettyServer("0.0.0.0", port, handlers, sc.conf))
logInfo("Started Spark Web UI at http://%s:%d".format(publicHost, boundPort))
} catch {
case e: Exception =>
Expand Down

0 comments on commit 7a8084e

Please sign in to comment.