forked from Sonnbc/modelCheckingNobi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathYCSBRun.sh
executable file
·104 lines (89 loc) · 2.81 KB
/
YCSBRun.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
#!/bin/bash
YCSB_HOME=modelCheckingYCSB/YCSB
DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)
USER=$(cat $DIR/clusterSetup/account | grep USER | awk '{print $2}')
DOMAIN=$(cat $DIR/clusterSetup/account | grep DOMAIN | awk {'print $2'})
usage()
{
echo "usage: $1 -n numnode [-l (load data) | -t (run test)]"
exit -1
}
get_hosts()
{
hosts=$(
for (( i = 0; i < $numnode; i++)); do
ssh $USER@node-0$i.$DOMAIN -C "
ifconfig | grep 10\.1\.1 | tr ':' ' ' | awk '{print \$3}'
"
done | tr "\\n" ",")
echo $hosts
}
load()
{
echo "Load $numnode"
echo $hosts
ssh $USER@node-00.$DOMAIN -C "
java -cp $YCSB_HOME/core/target/*:$YCSB_HOME/lib/*:$YCSB_HOME/cassandra/target/cassandra-binding-0.1.4.jar \
com.yahoo.ycsb.Client -load -db com.yahoo.ycsb.db.CassandraClient10 \
-p cassandra.writeconsistencylevel=QUORUM -p cassandra.readconsistencylevel=QUORUM \
-P $YCSB_HOME/workloads/modelCheckingWorkload -threads 1 -clientid 0 \
-p hosts=\"$hosts\"
"
}
run_test()
{
echo "Run test $numnode"
ssh $USER@node-00.$DOMAIN -C "
java -cp $YCSB_HOME/core/target/*:$YCSB_HOME/lib/*:$YCSB_HOME/cassandra/target/cassandra-binding-0.1.4.jar \
com.yahoo.ycsb.Client -t -db com.yahoo.ycsb.db.CassandraClient10 \
-p cassandra.writeconsistencylevel=QUORUM -p cassandra.readconsistencylevel=QUORUM \
-P $YCSB_HOME/workloads/modelCheckingWorkload -threads 50 \
-clientid 0 \
-target 10 \
-p hosts=\"$hosts\"
" 2> node-00.log &
ssh $USER@node-01.$DOMAIN -C "
java -cp $YCSB_HOME/core/target/*:$YCSB_HOME/lib/*:$YCSB_HOME/cassandra/target/cassandra-binding-0.1.4.jar \
com.yahoo.ycsb.Client -t -db com.yahoo.ycsb.db.CassandraClient10 \
-p cassandra.writeconsistencylevel=ONE -p cassandra.readconsistencylevel=ONE \
-P $YCSB_HOME/workloads/modelCheckingWorkload -threads 50 \
-clientid 1 \
-target 10 \
-p hosts=\"$hosts\"
" 2> node-01.log &
wait
cat node-0*.log
#rm node-0*.log
}
#run_test()
#{
# echo "Run test $numnode"
# for (( i = 0; i < $numnode; i++)); do
# ssh $USER@node-0$i.$DOMAIN -C "
# java -cp $YCSB_HOME/core/target/*:$YCSB_HOME/lib/*:$YCSB_HOME/cassandra/target/cassandra-binding-0.1.4.jar \
# com.yahoo.ycsb.Client -t -db com.yahoo.ycsb.db.CassandraClient10 \
# -p cassandra.writeconsistencylevel=QUORUM -p cassandra.readconsistencylevel=QUORUM \
# -P $YCSB_HOME/workloads/modelCheckingWorkload -threads 50 \
# -clientid $i \
# -target 10 \
# -p hosts=\"$hosts\"
# " 2> node-0$i.log &
# done
#
# wait
#
# cat node-0*.log
# #rm node-0*.log
#}
while getopts "ltn:" opt; do
case "$opt" in
l) action='load';;
t) action='run_test';;
n) numnode=$OPTARG;;
esac
done
if [ -z "$numnode" ] || [ -z "$action" ]; then
usage $0
fi
hosts=$(get_hosts)
$action