-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcluster
executable file
·69 lines (60 loc) · 1.15 KB
/
cluster
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/bin/bash
START='sudo systemctl start'
STOP='sudo systemctl stop'
STATUS='sudo systemctl status'
ZOO='zookeeper'
ASERV='accumulo-{master,tserver,gc,tracer,monitor}.service'
HNAME='hadoop-namenode'
HDATA='hadoop-datanode'
usage() {
echo "usage: cluster [<start|stop> <hadoop|zookeeper|accumulo>]"
echo " cluster start|stop = starts/stops entire cluster"
echo " cluster = print status of the cluster"
}
stats() {
echo "Cluster processes currently running:"
jps -lm | grep apache | sort
}
#zookeeper and accumulo
BINDIR='bin'
if [[ -z "$1" ]]
then
stats
exit
fi
if [[ "$1" != "start" && "$1" != "stop" ]]
then
usage
exit
fi
# 2 params
if [[ -n "$2" ]]
then
# second is hadoop
if [[ "$2" == "hadoop" ]]
then
fi
if [[ "$2" == "zookeeper" ]]
then
cd $ZOOKEEPER_HOME
CMD="zkServer.sh $1"
else
CMD="$1-all.sh"
fi
echo "cluster is $1-ing $2"
$SW/cluster/$2/$BINDIR/$CMD
exit
fi
if [[ -n "$1" ]]
then
if [[ "$1" == "start" ]]
then
echo "Starting entire cluster"
~/scripts/cluster-start
fi
if [[ "$1" == "stop" ]]
then
echo "Stopping entire cluster"
~/scripts/cluster-stop
fi
fi