Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SPARK-1348 binding Master, Worker, and App Web UI to all interfaces #318

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this distinction necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. Just tested, 0.0.0.0 binds to all. will drop the change.

Hmm, I thought there was a reason previous impl chose to use val server = new Server(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