forked from occlum/occlum
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrun_mysql_server.sh
executable file
·42 lines (27 loc) · 960 Bytes
/
run_mysql_server.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
#!/bin/bash
set -e
GREEN='\033[1;32m'
NC='\033[0m'
SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
bomfile=${SCRIPT_DIR}/mysql.yaml
MYSQL=mysql
MYSQLD=mysqld
# 1. Init Occlum instance
rm -rf occlum_instance && occlum new occlum_instance
pushd occlum_instance
new_json="$(jq '.resource_limits.user_space_size = "8000MB" |
.resource_limits.kernel_space_heap_size ="1000MB" |
.resource_limits.max_num_of_threads = 96' Occlum.json)" && \
echo "${new_json}" > Occlum.json
# 2. Copy files into Occlum instance and build
rm -rf image
copy_bom -f $bomfile --root image --include-dir /opt/occlum/etc/template
occlum build
# 3. Run the program
echo -e "${GREEN}Run mysql server (mysqld) on Occlum${NC}"
occlum start
echo -e "${GREEN}mysql server initialize${NC}"
occlum exec /bin/${MYSQLD} --initialize-insecure --user=root
echo -e "${GREEN}mysql server start${NC}"
occlum exec /bin/${MYSQLD} --user=root
popd