-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeployISPN.sh
executable file
·144 lines (130 loc) · 5.03 KB
/
deployISPN.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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
#!/bin/bash -
#===============================================================================
#
# FILE: deployISPN.sh
#
# USAGE: ./deployISPN.sh
#
# DESCRIPTION:
#
# OPTIONS: ---
# REQUIREMENTS: ---
# BUGS: ---
# NOTES: ---
# AUTHOR: Raziel Carvajal-Gomez (RCG), [email protected]
# ORGANIZATION:
# CREATED: 01/29/2017 21:08
# REVISION: ---
#===============================================================================
set -o nounset # Treat unset variables as an error
if [ ${#} -lt 2 ] ; then
echo "USAGE: $0 [Site ID to bootstrap YCSB-ISPN] [Site ID of ISPN-master]"
exit 1
fi
cli=${1} ; mas=${2}
isT=`grep "${cli}" mapCloudAp | wc -l`
if [ ${isT} -eq 0 ] ; then
echo "ERROR: site ${cli} is not in the list of sites to deploy ISPN"
exit 1
fi
isT=`grep "${mas}" mapCloudAp | wc -l`
if [ ${isT} -eq 0 ] ; then
echo "ERROR: site ${mas} is not in the list of sites to deploy ISPN"
exit 1
fi
echo "Getting list of IPs of ISNP servers"
masIp=`cat mapCloudAp | grep ${mas} | awk '{print $2}'`
cliIp=`cat mapCloudAp | grep ${cli} | awk '{print $2}'`
serverStr="${masIp}[7800],"
sitN=`cat mapCloudAp | wc -l`
for (( s=1; s<=${sitN}; s+=1 )); do
sitId=`cat mapCloudAp | head -${s} | tail -1 | awk '{print $1}'`
sitIp=`cat mapCloudAp | head -${s} | tail -1 | awk '{print $2}'`
if [ "${sitId}" != "${mas}" ] ; then
if [ "${sitId}" != "${cli}" ] ; then
serverStr="${serverStr}${sitIp}[7800],"
fi
fi
done
# Remove last coma from ${serverStr}
seStLen=$((${#serverStr}-1))
serList=${serverStr:0:${seStLen}}
cliList="${masIp}:11222"
echo -e "\tString of ISPN for servers: ${serList}"
echo -e "\tString of YCSB: ${cliList}"
echo "DONE"
cfgFd="cfgFiles"
rm -fr ${cfgFd} ; mkdir ${cfgFd}
echo "Creating configuration files and launching ISPN servers..."
#ispnSerOpt="-r hotrod -Djgroups.tcpping.timeout=${PING_ISPN} -Djgroups.tcpping.num_initial_members=2"
ispnSerOpt="-r hotrod"
ispnSerOpt=${ispnSerOpt}" -Djgroups.tcpping.initial_hosts"
for (( cf=1; cf<=${sitN}; cf+=1 )); do
sitId=`cat mapCloudAp | head -${cf} | tail -1 | awk '{print $1}'`
sitIp=`cat mapCloudAp | head -${cf} | tail -1 | awk '{print $2}'`
if [ "${sitId}" != "${cli}" ] ; then
fNam="node-${cf}.xml"
fLoc="${cfgFd}/${fNam}"
cat distributedCache.xml >${fLoc}
sed -i s/"machineId=\"MACHINE_ID\""/"machineId=\"node-${sitId}\""/ ${fLoc}
sed -i s/"nodeName=\"NODE_ID\""/"nodeName=\"node-${sitId}\""/ ${fLoc}
echo -e "\tISPN cfg file of site ${sitId} is done\n\tCopying cfg file in site ${sitId}"
scp ${fLoc} ${sitId}-ca:~/infinispan
echo -e "\t\tDONE\n\tLaunching ISPN at site ${sitId}..."
cmd="cd ~/infinispan ; ./bin/startServer.sh -c ${fNam} -l ${sitIp} -Djgroups.bind_addr=${sitIp}"
cmd=${cmd}" ${ispnSerOpt}=${serList} &>/dev/null &"
echo -e "\tcurrent command: ${cmd}"
ssh ${sitId}-ca "${cmd}"
echo -e "\t\tDONE"
fi
done
echo "DONE"
#TODO find a better way to wait until all ISPN servers boostrap
echo "Waiting for letting ISPN servers to bootstrap"
sleep 60
echo -e "\tDONE"
caCfg="${cfgFd}/distributed-cache.properties"
cat ycsbCacheCfg >${caCfg}
echo "infinispan.client.hotrod.server_list=${cliList}" >>${caCfg}
echo "Copying cfg file of YCSB cache..."
scp ${caCfg} ${cli}-ca:~/ycsb-infinispan
echo -e "\tDONE"
#Reading YCSB options from <<ycsbBenchCfg>> file
wTy=`grep "workload=" ycsbBenchCfg | awk -F "=" '{print $2}'`
ycsbLoaOpt="load basic -s -P workloads/workload${wTy} -P distributed-cache.properties -p measurementtype=raw -p"
ycsbLoaOpt=${ycsbLoaOpt}" measurement.raw.output_file=load.out"
ycsbRunOpt="run basic -s -P workloads/workload${wTy} -P distributed-cache.properties -p measurementtype=raw -p"
ycsbRunOpt=${ycsbRunOpt}" measurement.raw.output_file=run.out"
optN=`cat ycsbBenchCfg | wc -l`
for (( opt=1; opt<=${optN}; opt+=1 )); do
optKeVa=`cat ycsbBenchCfg | head -${opt} | tail -1`
key=`echo "${optKeVa}" | awk -F "=" '{print $1}'`
if [ "${key}" != "workload" ] ; then
ycsbLoaOpt=${ycsbLoaOpt}" -p ${optKeVa}"
ycsbRunOpt=${ycsbRunOpt}" -p ${optKeVa}"
fi
done
echo "YCSB <<load>> phase with options as follows: ${ycsbLoaOpt}"
ssh ${cli}-ca "cd ~/ycsb-infinispan ; ./bin/ycsb.sh ${ycsbLoaOpt}"
echo -e "\tDONE"
echo "YCSB <<run>> phase with options as follows: ${ycsbRunOpt}"
ssh ${cli}-ca "cd ~/ycsb-infinispan ; ./bin/ycsb.sh ${ycsbRunOpt}"
echo -e "\tDONE"
echo "Getting ISPN dataset..."
dat="infinispan"
cmd="cd ~/ycsb-infinispan ; rm -fr ${dat}.tgz ; rm -fr ${dat} ; mkdir ${dat}"
cmd="${cmd} ; mv load.out run.out ${dat} ; ~/tar czf ${dat}.tgz ${dat}"
ssh ${cli}-ca "${cmd}"
scp ${cli}-ca:~/ycsb-infinispan/${dat}.tgz .
echo -e "\tDONE"
#STOP experiment
for (( cf=1; cf<=${sitN}; cf+=1 )); do
sitId=`cat mapCloudAp | head -${cf} | tail -1 | awk '{print $1}'`
sitIp=`cat mapCloudAp | head -${cf} | tail -1 | awk '{print $2}'`
if [ "${sitId}" != "${cli}" ] ; then
echo "Stop ISPN server in site ${sitId}"
ssh ${sitId}-ca "pkill java ; pkill startServer.sh"
fi
echo -e "\tDONE"
done
echo "ISPN EXPERIMENT IS FINISHED"