-
Notifications
You must be signed in to change notification settings - Fork 47
/
entrypoint-yarn.sh
executable file
·53 lines (40 loc) · 1.11 KB
/
entrypoint-yarn.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/bash
SPARK_WORKLOAD=$1
echo "SPARK_WORKLOAD: $SPARK_WORKLOAD"
/etc/init.d/ssh start
if [ "$SPARK_WORKLOAD" == "master" ];
then
hdfs namenode -format
# start the master node processes
hdfs --daemon start namenode
hdfs --daemon start secondarynamenode
yarn --daemon start resourcemanager
# create required directories
while ! hdfs dfs -mkdir -p /spark-logs;
do
echo "Failed creating /spark-logs hdfs dir"
done
echo "Created /spark-logs hdfs dir"
hdfs dfs -mkdir -p /opt/spark/data
echo "Created /opt/spark/data hdfs dir"
# copy the data to the data HDFS directory
hdfs dfs -copyFromLocal /opt/spark/data/* /opt/spark/data
hdfs dfs -ls /opt/spark/data
elif [ "$SPARK_WORKLOAD" == "worker" ];
then
hdfs namenode -format
# start the worker node processes
hdfs --daemon start datanode
yarn --daemon start nodemanager
elif [ "$SPARK_WORKLOAD" == "history" ];
then
while ! hdfs dfs -test -d /spark-logs;
do
echo "spark-logs doesn't exist yet... retrying"
sleep 1;
done
echo "Exit loop"
# start the spark history server
start-history-server.sh
fi
tail -f /dev/null