Skip to content

Commit 7a8084e

Browse files
committed
SPARK-1348 binding Master, Worker, and App Web UI to all interfaces
1 parent 92a86b2 commit 7a8084e

File tree

4 files changed

+7
-4
lines changed

4 files changed

+7
-4
lines changed

core/src/main/scala/org/apache/spark/deploy/master/ui/MasterWebUI.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class MasterWebUI(val master: Master, requestedPort: Int) extends Logging {
5959

6060
def bind() {
6161
try {
62-
serverInfo = Some(startJettyServer(host, port, handlers, master.conf))
62+
serverInfo = Some(startJettyServer("0.0.0.0", port, handlers, master.conf))
6363
logInfo("Started Master web UI at http://%s:%d".format(host, boundPort))
6464
} catch {
6565
case e: Exception =>

core/src/main/scala/org/apache/spark/deploy/worker/ui/WorkerWebUI.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class WorkerWebUI(val worker: Worker, val workDir: File, requestedPort: Option[I
6060

6161
def bind() {
6262
try {
63-
serverInfo = Some(JettyUtils.startJettyServer(host, port, handlers, worker.conf))
63+
serverInfo = Some(JettyUtils.startJettyServer("0.0.0.0", port, handlers, worker.conf))
6464
logInfo("Started Worker web UI at http://%s:%d".format(host, boundPort))
6565
} catch {
6666
case e: Exception =>

core/src/main/scala/org/apache/spark/ui/JettyUtils.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,10 @@ private[spark] object JettyUtils extends Logging {
177177

178178
@tailrec
179179
def connect(currentPort: Int): (Server, Int) = {
180-
val server = new Server(new InetSocketAddress(hostName, currentPort))
180+
val server = if ("0.0.0.0".equals(hostName))
181+
new Server(currentPort)
182+
else
183+
new Server(new InetSocketAddress(hostName, currentPort))
181184
val pool = new QueuedThreadPool
182185
pool.setDaemon(true)
183186
server.setThreadPool(pool)

core/src/main/scala/org/apache/spark/ui/SparkUI.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ private[spark] class SparkUI(
8080
/** Bind the HTTP server which backs this web interface */
8181
def bind() {
8282
try {
83-
serverInfo = Some(startJettyServer(bindHost, port, handlers, sc.conf))
83+
serverInfo = Some(startJettyServer("0.0.0.0", port, handlers, sc.conf))
8484
logInfo("Started Spark Web UI at http://%s:%d".format(publicHost, boundPort))
8585
} catch {
8686
case e: Exception =>

0 commit comments

Comments
 (0)