-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Jitender Kumar <jitender.kumar@intel.com>
- Loading branch information
Showing
3 changed files
with
32 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,53 @@ | ||
# MySQL example | ||
This example is tested with MySQL version 8.0.29. | ||
|
||
This directory contains an example for running Mysql server in Gramine, including | ||
This directory contains an example for running MySQL server in Gramine, including | ||
the Makefile and a template for generating the manifest. | ||
|
||
# Pre-requisites | ||
## Pre-requisites | ||
|
||
- `sudo apt-get install mysql-server` to install MySQL server. | ||
- Comment out the log line `log_error = /var/log/mysql/error.log` in the config file | ||
- Comment out the log line `log_error = /var/log/mysql/error.log` in the config file | ||
`/etc/mysql/mysql.conf.d/mysqld.cnf` to see the log on console. | ||
- `systemctl stop mysql.service` to stop the default MySQL service .We will manually | ||
- `systemctl stop mysql.service` to stop the default MySQL service. We will manually | ||
run MySQL process. | ||
- `sudo mkdir /var/run/mysqld && sudo chown -R <current_user>:<current_user> /var/run/mysqld` | ||
- `sudo mkdir /var/run/mysqld && sudo chown -R <current_user>:<current_user> /var/run/mysqld` | ||
to allow MySQL server to create socket file `mysqld.sock`. | ||
- `sudo chown -R <current_user>:<current_user> /var/lib/mysql-files` to allow MySQL server for | ||
internal usage. | ||
- `sudo chown -R <current_user>:<current_user> /var/lib/mysql-keyring` to allow MySQL server for | ||
internal usage. | ||
- `mysqld --initialize-insecure --datadir=mysql-data/` to initialize data directory. | ||
- `sudo chown -R <current_user>:<current_user> /var/lib/mysql-files` to allow running | ||
MySQL server under the current non-root user. | ||
- `sudo chown -R <current_user>:<current_user> /var/lib/mysql-keyring` to allow running | ||
MySQL server under the current non-root user. | ||
- `mysqld --initialize-insecure --datadir=/tmp/mysql-data` to initialize data directory. For | ||
details on '--initialize-insecure', please see the https://dev.mysql.com/doc/mysql-linuxunix-excerpt/5.7/en/data-directory-initialization.html page. | ||
|
||
# Build | ||
## Build | ||
|
||
Run `make` to build the non-SGX version and `make SGX=1` to build the SGX | ||
version. | ||
|
||
# Run | ||
## Run | ||
|
||
Execute any one of the following commands to run the workload: | ||
|
||
- Natively: `mysqld --datadir /tmp/mysql`. | ||
- Gramine w/o SGX: `gramine-direct mysqld -u root --datadir /tmp/mysql`. | ||
- Gramine with SGX: `gramine-sgx mysqld -u root --datadir /tmp/mysql`. | ||
- Natively: `mysqld --datadir /tmp/mysql-data`. | ||
- Gramine w/o SGX: `gramine-direct mysqld --datadir /tmp/mysql-data`. | ||
- Gramine with SGX: `gramine-sgx mysqld --datadir /tmp/mysql-data`. | ||
|
||
# Testing client connection and running sysbench benchmarking | ||
## Testing client connection and running Sysbench | ||
|
||
Run below command from new terminal: | ||
Run below commands from new terminal: | ||
|
||
- `mysql -P 3306 --protocol=tcp -uroot` to connect a client to MySQL server. | ||
- `mysql -P 3306 --protocol=tcp -u root` to connect a client to MySQL server. | ||
- `mysql> exit` to disconnect the client. | ||
|
||
Run Sysbench benchmarking: | ||
Run Sysbench: | ||
|
||
- `sudo apt install -y sysbench` to install sysbench. | ||
- `sudo apt install -y sysbench` to install Sysbench. | ||
- `sudo mysqladmin -h 127.0.0.1 -P 3306 create sbtest` to create test database. | ||
|
||
- `sysbench --db-driver=mysql --mysql-host=127.0.0.1 --mysql-port=3306 --mysql-user=root --mysql-db=sbtest --time=20 --report-interval=5 oltp_read_write --tables=2 --table_size=100000 --threads=32 prepare` to | ||
create records in test database. | ||
- `sysbench --db-driver=mysql --mysql-host=127.0.0.1 --mysql-port=3306 --mysql-user=root --mysql-db=sbtest --time=20 --report-interval=5 oltp_read_write --tables=2 --table_size=100000 --threads=32 run` to | ||
run the sysbench benchmarks. | ||
run the Sysbench benchmarks. | ||
- `sysbench --db-driver=mysql --mysql-host=127.0.0.1 --mysql-port=3306 --mysql-user=root --mysql-db=sbtest --time=20 --report-interval=5 oltp_read_write --tables=2 --table_size=100000 --threads=32 cleanup` to | ||
delete the records from test database. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters