Back to home page

OSCL-LXR

 
 

    


0001 #!/usr/bin/env bash
0002 
0003 #
0004 # Licensed to the Apache Software Foundation (ASF) under one or more
0005 # contributor license agreements.  See the NOTICE file distributed with
0006 # this work for additional information regarding copyright ownership.
0007 # The ASF licenses this file to You under the Apache License, Version 2.0
0008 # (the "License"); you may not use this file except in compliance with
0009 # the License.  You may obtain a copy of the License at
0010 #
0011 #    http://www.apache.org/licenses/LICENSE-2.0
0012 #
0013 # Unless required by applicable law or agreed to in writing, software
0014 # distributed under the License is distributed on an "AS IS" BASIS,
0015 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0016 # See the License for the specific language governing permissions and
0017 # limitations under the License.
0018 #
0019 
0020 # Starts a slave instance on each machine specified in the conf/slaves file.
0021 
0022 if [ -z "${SPARK_HOME}" ]; then
0023   export SPARK_HOME="$(cd "`dirname "$0"`"/..; pwd)"
0024 fi
0025 
0026 . "${SPARK_HOME}/sbin/spark-config.sh"
0027 . "${SPARK_HOME}/bin/load-spark-env.sh"
0028 
0029 # Find the port number for the master
0030 if [ "$SPARK_MASTER_PORT" = "" ]; then
0031   SPARK_MASTER_PORT=7077
0032 fi
0033 
0034 if [ "$SPARK_MASTER_HOST" = "" ]; then
0035   case `uname` in
0036       (SunOS)
0037           SPARK_MASTER_HOST="`/usr/sbin/check-hostname | awk '{print $NF}'`"
0038           ;;
0039       (*)
0040           SPARK_MASTER_HOST="`hostname -f`"
0041           ;;
0042   esac
0043 fi
0044 
0045 # Launch the slaves
0046 "${SPARK_HOME}/sbin/slaves.sh" cd "${SPARK_HOME}" \; "${SPARK_HOME}/sbin/start-slave.sh" "spark://$SPARK_MASTER_HOST:$SPARK_MASTER_PORT"