-
Notifications
You must be signed in to change notification settings - Fork 57
/
start-hadoop.sh
executable file
·38 lines (32 loc) · 1.12 KB
/
start-hadoop.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
#!/bin/bash
source "/vagrant/scripts/common.sh"
function startDaemons {
echo "starting Hadoop daemons"
$HADOOP_PREFIX/sbin/hadoop-daemon.sh --config $HADOOP_CONF --script hdfs start namenode
$HADOOP_PREFIX/sbin/hadoop-daemon.sh --config $HADOOP_CONF --script hdfs start datanode
$HADOOP_YARN_HOME/sbin/yarn-daemon.sh start resourcemanager --config $HADOOP_CONF
$HADOOP_YARN_HOME/sbin/yarn-daemons.sh start nodemanager --config $HADOOP_CONF
$HADOOP_YARN_HOME/sbin/yarn-daemon.sh start proxyserver --config $HADOOP_CONF
$HADOOP_PREFIX/sbin/mr-jobhistory-daemon.sh start historyserver --config $HADOOP_CONF
echo "waiting for HDFS to come up"
# loop until at least HDFS is up
cmd="$HADOOP_PREFIX/bin/hdfs dfs -ls /"
NEXT_WAIT_TIME=0
up=0
while [ $NEXT_WAIT_TIME -ne 4 ] ; do
$cmd
rc=$?
if [[ $rc == 0 ]]; then
up=1
break
fi
sleep $(( NEXT_WAIT_TIME++ ))
done
if [[ $up != 1 ]]; then
echo "HDFS doesn't seem to be up; exiting"
exit $rc
fi
echo "listing all Java processes"
jps
}
startDaemons