-
Notifications
You must be signed in to change notification settings - Fork 22
/
check_mysql.sh
executable file
·55 lines (43 loc) · 1.2 KB
/
check_mysql.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
#!/bin/sh
export GO111MODULE=auto
DIR=$(cd $(dirname $0); pwd)
ROOTDIR=$(dirname $(dirname $DIR))
##################################################################
echo ""
echo "1. Prepare MYSQL 8.0 Server using Docker."
echo ""
docker pull mysql:8.0
docker stop goptuna-mysql
set -e
cd ${DIR}
docker run \
-d \
--rm \
-p 3306:3306 \
--mount type=volume,src=mysql,dst=/etc/mysql/conf.d \
-e MYSQL_USER=goptuna \
-e MYSQL_DATABASE=goptuna \
-e MYSQL_PASSWORD=password \
-e MYSQL_ALLOW_EMPTY_PASSWORD=yes \
--name goptuna-mysql \
mysql:8.0
cd -
echo "Wait ready for mysql"
sleep 20
##################################################################
echo ""
echo "2. Run Goptuna optimizations."
echo ""
go run ${DIR}/main.go mysql "goptuna:password@tcp(localhost:3306)/goptuna?parseTime=true"
##################################################################
echo ""
echo "3. View the optimization results on Goptuna bulit-in dashboard."
echo ""
set +e
go run ${ROOTDIR}/cmd/main.go dashboard --storage mysql://goptuna:[email protected]:3306/goptuna
set -e
##################################################################
echo ""
echo "4. Stop MYSQL Server"
echo ""
docker stop goptuna-mysql