-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstart.sh
133 lines (98 loc) · 3.14 KB
/
start.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#!/bin/bash
USERNAME=achla
#loading namenode config
file="config/namenode.properties"
if [ -f "$file" ]
then
#echo "$file found."
while IFS='=' read -r key value
do
key=$(echo $key)
eval ${key}=\${value}
done < "$file"
#echo "namenode Ip = " ${ip}
#echo "namenode port = " ${port}
else
echo "$file not found."
fi
NAMENODE_HOST=${ip}
NAMENODE_PORT=${port}
#launching nameNode
SCRIPT="cd workspace/hidoop/bin; screen -d -m java hdfs.NameNodeImpl"
#ssh-keygen -t rsa -b 2048
#ssh-copy-id $USERNAME@$NAMENODE_HOST
ssh -l ${USERNAME} ${NAMENODE_HOST} "${SCRIPT}"
echo "nameNode started at: ${NAMENODE_HOST}:${NAMENODE_PORT}"
echo "---------------------------------------------"
#loading ressourceManager config
file="config/ressourcemanager.properties"
if [ -f "$file" ]
then
#echo "$file found."
while IFS='=' read -r key value
do
key=$(echo $key)
eval ${key}=\${value}
done < "$file"
#echo "namenode Ip = " ${ip}
#echo "namenode port = " ${port}
else
echo "$file not found."
fi
RM_HOST=${ip}
RM_PORT=${port}
#launching nameNode
SCRIPT="cd workspace/hidoop/bin; screen -d -m java ordo.RessourceManagerImpl"
#ssh-keygen -t rsa -b 2048
#ssh-copy-id $USERNAME@$NAMENODE_HOST
ssh -l ${USERNAME} ${RM_HOST} "${SCRIPT}"
echo "ressourceManager started at: ${RM_HOST}:${RM_PORT}"
echo "---------------------------------------------"
#loading datanodes config
filename="config/datanodes.properties"
if [ -f "$filename" ]
then
#echo "$filename found."
hostArr=($(grep "host" $filename))
portArr=($(grep "port" $filename))
NB_HOSTS=${#hostArr[@]}
SCRIPT="cd workspace/hidoop/bin; screen -d -m java hdfs.HdfsServer"
for (( i=0; i<${NB_HOSTS}; i++ ))
do
hostVal=$(cut -d"=" -f2 <<< ${hostArr[i]})
portVal=$(cut -d"=" -f2 <<< ${portArr[i]})
#launching datanodes
#ssh-copy-id $USERNAME@$hostVal
ssh -l ${USERNAME} ${hostVal} "${SCRIPT} ${hostVal} ${portVal}"
#ssh -l ${USERNAME} ${hostVal} "${SCRIPT} ${hostVal} ${portVal} &"
echo "datanode started at: ${hostVal}:${portVal}"
echo "---------------------------------------------"
done
else
ec ho "$filename not found."
fi
#loading daemons config
filename="config/nodemanagers.properties"
if [ -f "$filename" ]
then
#echo "$filename found."
hostDaemonArr=($(grep "host" $filename))
portDaemonArr=($(grep "port" $filename))
nameDaemonArr=($(grep "name" $filename))
NB_DAEMONS=${#hostDaemonArr[@]}
SCRIPT="cd workspace/hidoop/bin; screen -d -m java ordo.NodeManagerImpl"
for (( i=0; i<${NB_DAEMONS}; i++ ))
do
hostDaemonVal=$(cut -d"=" -f2 <<< ${hostDaemonArr[i]})
portDaemonVal=$(cut -d"=" -f2 <<< ${portDaemonArr[i]})
nameDaemonVal=$(cut -d"=" -f2 <<< ${nameDaemonArr[i]})
#launching datanodes
#ssh-copy-id $USERNAME@$hostDaemonVal
ssh -l ${USERNAME} ${hostDaemonVal} "${SCRIPT} ${nameDaemonVal} ${hostDaemonVal} ${portDaemonVal}"
#ssh -l ${USERNAME} ${hostDaemonVal} "${SCRIPT} ${hostDaemonVal} ${portDaemonVal} &"
echo "nodeManager started at: ${hostDaemonVal}:${portDaemonVal}"
echo "---------------------------------------------"
done
else
echo "$filename not found."
fi