2121#
2222# Environment Variables
2323#
24- # SPARK_WORKER_INSTANCES The number of worker instances to run on this
24+ # SPARK_WORKER_INSTANCES The number of worker instances to run on this
2525# slave. Default is 1.
26- # SPARK_WORKER_PORT The base port number for the first worker. If set,
26+ # SPARK_WORKER_PORT The base port number for the first worker. If set,
2727# subsequent workers will increment this number. If
2828# unset, Spark will find a valid port number, but
2929# with no guarantee of a predictable pattern.
3030# SPARK_WORKER_WEBUI_PORT The base port for the web interface of the first
31- # worker. Subsequent workers will increment this
31+ # worker. Subsequent workers will increment this
3232# number. Default is 8081.
3333
3434usage=" Usage: start-slave.sh <spark-master-URL> where <spark-master-URL> is like spark://localhost:7077"
@@ -39,8 +39,28 @@ if [ $# -lt 1 ]; then
3939 exit 1
4040fi
4141
42- sbin=" ` dirname " $0 " ` "
43- sbin=" ` cd " $sbin " ; pwd` "
42+ realpath () {
43+ (
44+ TARGET_FILE=" $1 "
45+
46+ cd " $( dirname " $TARGET_FILE " ) "
47+ TARGET_FILE=" $( basename " $TARGET_FILE " ) "
48+
49+ COUNT=0
50+ while [ -L " $TARGET_FILE " -a $COUNT -lt 100 ]
51+ do
52+ TARGET_FILE=" $( readlink " $TARGET_FILE " ) "
53+ cd $( dirname " $TARGET_FILE " )
54+ TARGET_FILE=" $( basename $TARGET_FILE ) "
55+ COUNT=$(( $COUNT + 1 ))
56+ done
57+
58+ echo " $( pwd -P) /" $TARGET_FILE " "
59+ )
60+ }
61+
62+ sbin=" $( dirname " $( realpath " $0 " ) " ) "
63+ sbin=" $( cd " $sbin " ; pwd) "
4464
4565. " $sbin /spark-config.sh"
4666
82102 start_instance $(( 1 + $i )) " $@ "
83103 done
84104fi
85-
0 commit comments