-
Notifications
You must be signed in to change notification settings - Fork 0
/
start.sh
executable file
·100 lines (93 loc) · 2.68 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
#!/usr/bin/env bash
WORKSPACE=$(cd `dirname $0`; pwd)
LIB_WORKSPACE=$WORKSPACE/lib
CONFPATH=.
DURATION=0
THREAD=0
while getopts ":c:n:m:t:d:s:h" opt
do
case $opt in
c)
CONFPATH="${OPTARG}"
;;
n)
expr ${OPTARG} "+" 10 &> /dev/null
if [ $? -ne 0 ]; then
echo 'The table count ['${OPTARG}'] is not a number'
exit 1
fi
TABLECOUNT="${OPTARG}"
;;
s)
expr ${OPTARG} "+" 10 &> /dev/null
if [ $? -ne 0 ]; then
echo 'The table size ['${OPTARG}'] is not a number'
exit 1
fi
TABLESIZE="${OPTARG}"
;;
d)
expr ${OPTARG} "+" 10 &> /dev/null
if [ $? -ne 0 ]; then
echo 'The duration ['${OPTARG}'] is not a number'
exit 1
fi
DURATION="${OPTARG}"
;;
t)
expr ${OPTARG} "+" 10 &> /dev/null
if [ $? -ne 0 ]; then
echo 'The threads ['${OPTARG}'] is not a number'
exit 1
fi
THREAD="${OPTARG}"
;;
m)
METHOD="${OPTARG}"
;;
h)
echo -e "Usage: bash run.sh [option] [param] ...\nExcute mo oltp load task"
echo -e " -c set config path, mo-load will use run.yml, replace.yml from this path"
echo -e " -n for sysbench data prepare, set table count, must designate method to SYSBENCH by -m"
echo -e " -s for sysbench data prepare, set table size, must designate method to SYSBENCH by -m"
echo -e " -t concurrency that test will run in"
echo -e " -m method that the test will run with, must be SYSBENCH or None"
echo -e " -d time that test will last, unit minute"
echo "For more support,please email to [email protected]"
exit 1
;;
?)
echo "Unkown parameter,please use -h to get help."
exit 1;;
esac
done
function start {
local libJars libJar
for libJar in `find ${LIB_WORKSPACE} -name "*.jar"`
do
libJars=${libJars}:${libJar}
done
java -Xms1024M -Xmx30720M -cp ${libJars} \
-Drun.yml=${CONFPATH}/run.yml \
-Dreplace.yml=${CONFPATH}/replace.yml \
io.mo.MOPerfTest ${DURATION} ${THREAD}
}
function prepare {
local libJars libJar
for libJar in `find ${LIB_WORKSPACE} -name "*.jar"`
do
libJars=${libJars}:${libJar}
done
java -Xms1024M -Xmx30720M -cp ${libJars} \
-Dsysbench.yml=${CONFPATH}/sysbench.yml \
io.mo.Sysbench ${TABLECOUNT} ${TABLESIZE}
}
if [[ "${METHOD}"x != x && "${METHOD}" != "SYSBENCH" ]]; then
echo "The method must be SYSBENCH or None, [${METHOD}] is not supported"
exit 1
fi
if [ "${METHOD}" = "SYSBENCH" ]; then
prepare
else
start
fi