-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.sh
60 lines (54 loc) · 1.21 KB
/
run.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
#!/bin/sh
set -u
set -e
ROOT=/tpcc-mysql
DATA=tpcc
W=1
L=30
while getopts "h:u:p:d:w:" opt; do
case $opt in
h)
HOST=$OPTARG
;;
u)
USER=$OPTARG
;;
p)
PASS=$OPTARG
;;
d)
DATA=$OPTARG
;;
w)
W=$OPTARG
;;
l)
L=$OPTARG
;;
esac
done
shift $((OPTIND-1))
case $1 in
init)
echo "==> init"
echo " mysql://${HOST}/${DATA}"
mysql -u${USER} -p${PASS} -h${HOST} -e "CREATE DATABASE ${DATA};"
mysql -u${USER} -p${PASS} -h${HOST} ${DATA} < ${ROOT}/create_table.sql
mysql -u${USER} -p${PASS} -h${HOST} ${DATA} < ${ROOT}/add_fkey_idx.sql
;;
load)
echo "==> load"
echo " mysql://${HOST}/${DATA}"
echo " ${W} warehouse"
${ROOT}/tpcc_load -h${HOST} -d${DATA} -u${USER} -p${PASS} -w${W}
;;
run)
echo "==> run"
echo " mysql://${HOST}/${DATA}"
echo " ${W} warehouse"
${ROOT}/tpcc_start -h${HOST} -d${DATA} -u${USER} -p${PASS} -w${W} -c4 -r5 -l${L}
;;
help)
echo "Usage:"
echo "docker run -it radondb/tpcc-mysql -h HOST -u USER -p PASS -d DATA init|load|run|help"
esac