Skip to content

Commit 50248dc

Browse files
bomengsrowen
bomeng
authored andcommitted
[SPARK-15806][DOCUMENTATION] update doc for SPARK_MASTER_IP
## What changes were proposed in this pull request? SPARK_MASTER_IP is a deprecated environment variable. It is replaced by SPARK_MASTER_HOST according to MasterArguments.scala. ## How was this patch tested? Manually verified. Author: bomeng <[email protected]> Closes apache#13543 from bomeng/SPARK-15806.
1 parent 3fd3ee0 commit 50248dc

File tree

5 files changed

+16
-10
lines changed

5 files changed

+16
-10
lines changed

conf/spark-env.sh.template

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
# - SPARK_DRIVER_MEMORY, Memory for Driver (e.g. 1000M, 2G) (Default: 1G)
4343

4444
# Options for the daemons used in the standalone deploy mode
45-
# - SPARK_MASTER_IP, to bind the master to a different IP address or hostname
45+
# - SPARK_MASTER_HOST, to bind the master to a different IP address or hostname
4646
# - SPARK_MASTER_PORT / SPARK_MASTER_WEBUI_PORT, to use non-default ports for the master
4747
# - SPARK_MASTER_OPTS, to set config properties only for the master (e.g. "-Dx=y")
4848
# - SPARK_WORKER_CORES, to set the number of cores to use on this machine

core/src/main/scala/org/apache/spark/deploy/master/MasterArguments.scala

+7-1
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,24 @@ package org.apache.spark.deploy.master
2020
import scala.annotation.tailrec
2121

2222
import org.apache.spark.SparkConf
23+
import org.apache.spark.internal.Logging
2324
import org.apache.spark.util.{IntParam, Utils}
2425

2526
/**
2627
* Command-line parser for the master.
2728
*/
28-
private[master] class MasterArguments(args: Array[String], conf: SparkConf) {
29+
private[master] class MasterArguments(args: Array[String], conf: SparkConf) extends Logging {
2930
var host = Utils.localHostName()
3031
var port = 7077
3132
var webUiPort = 8080
3233
var propertiesFile: String = null
3334

3435
// Check for settings in environment variables
36+
if (System.getenv("SPARK_MASTER_IP") != null) {
37+
logWarning("SPARK_MASTER_IP is deprecated, please use SPARK_MASTER_HOST")
38+
host = System.getenv("SPARK_MASTER_IP")
39+
}
40+
3541
if (System.getenv("SPARK_MASTER_HOST") != null) {
3642
host = System.getenv("SPARK_MASTER_HOST")
3743
}

docs/spark-standalone.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ You can optionally configure the cluster further by setting environment variable
9494
<table class="table">
9595
<tr><th style="width:21%">Environment Variable</th><th>Meaning</th></tr>
9696
<tr>
97-
<td><code>SPARK_MASTER_IP</code></td>
98-
<td>Bind the master to a specific IP address, for example a public one.</td>
97+
<td><code>SPARK_MASTER_HOST</code></td>
98+
<td>Bind the master to a specific hostname or IP address, for example a public one.</td>
9999
</tr>
100100
<tr>
101101
<td><code>SPARK_MASTER_PORT</code></td>

sbin/start-master.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,14 @@ if [ "$SPARK_MASTER_PORT" = "" ]; then
4747
SPARK_MASTER_PORT=7077
4848
fi
4949

50-
if [ "$SPARK_MASTER_IP" = "" ]; then
51-
SPARK_MASTER_IP=`hostname`
50+
if [ "$SPARK_MASTER_HOST" = "" ]; then
51+
SPARK_MASTER_HOST=`hostname`
5252
fi
5353

5454
if [ "$SPARK_MASTER_WEBUI_PORT" = "" ]; then
5555
SPARK_MASTER_WEBUI_PORT=8080
5656
fi
5757

5858
"${SPARK_HOME}/sbin"/spark-daemon.sh start $CLASS 1 \
59-
--ip $SPARK_MASTER_IP --port $SPARK_MASTER_PORT --webui-port $SPARK_MASTER_WEBUI_PORT \
59+
--host $SPARK_MASTER_HOST --port $SPARK_MASTER_PORT --webui-port $SPARK_MASTER_WEBUI_PORT \
6060
$ORIGINAL_ARGS

sbin/start-slaves.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ if [ "$SPARK_MASTER_PORT" = "" ]; then
3131
SPARK_MASTER_PORT=7077
3232
fi
3333

34-
if [ "$SPARK_MASTER_IP" = "" ]; then
35-
SPARK_MASTER_IP="`hostname`"
34+
if [ "$SPARK_MASTER_HOST" = "" ]; then
35+
SPARK_MASTER_HOST="`hostname`"
3636
fi
3737

3838
# Launch the slaves
39-
"${SPARK_HOME}/sbin/slaves.sh" cd "${SPARK_HOME}" \; "${SPARK_HOME}/sbin/start-slave.sh" "spark://$SPARK_MASTER_IP:$SPARK_MASTER_PORT"
39+
"${SPARK_HOME}/sbin/slaves.sh" cd "${SPARK_HOME}" \; "${SPARK_HOME}/sbin/start-slave.sh" "spark://$SPARK_MASTER_HOST:$SPARK_MASTER_PORT"

0 commit comments

Comments
 (0)