在ubuntu20.04.6下,已经下载了wget https://gitee.com/xiaoluoji/sysbench-tpcc/tree/master,如何使用 sysbench 跑 tpcc 测试,500仓,记录测试结果 tpmC
时间: 2023-07-05 19:23:09 浏览: 49
首先,你需要安装 MySQL 数据库,并且创建一个名为 `tpcc` 的数据库,然后下载并安装 `sysbench`。
接下来,你可以执行以下命令来生成 TPCC 测试数据:
```
sysbench tpcc --mysql-db=tpcc --mysql-user=root --mysql-password=your_password --mysql-host=localhost --tables=10 --scale=500 --trx_level=RC prepare
```
其中,`--mysql-user` 和 `--mysql-password` 分别为你的 MySQL 数据库的用户名和密码,`--mysql-host` 为 MySQL 数据库所在的主机地址,`--tables` 为生成的表格数量,`--scale` 为生成的记录数量,`--trx_level` 为事务隔离级别。
接下来,你可以执行以下命令来运行 TPCC 测试:
```
sysbench tpcc --mysql-db=tpcc --mysql-user=root --mysql-password=your_password --mysql-host=localhost --tables=10 --scale=500 --trx_level=RC --threads=64 --time=300 run
```
其中,`--threads` 为并发数,`--time` 为测试时间。
测试结束后,你可以得到测试结果,包括 tpmC 等。
相关问题
在ubuntu20.04.6下,已经下载了wget https://gitee.com/xiaoluoji/sysbench-tpcc/tree/master之后如何进行TPCC测试
首先,你需要安装 `sysbench`。在 Ubuntu 上,你可以通过以下命令安装:
```bash
sudo apt-get update
sudo apt-get install sysbench
```
安装完成后,你可以使用以下命令下载 `TPCC` 测试文件:
```bash
wget https://gitee.com/xiaoluoji/sysbench-tpcc/archive/master.zip
```
解压文件:
```bash
unzip master.zip
```
进入解压后的文件夹:
```bash
cd sysbench-tpcc-master
```
创建 `tpcc` 数据库:
```bash
sysbench --db-driver=mysql --mysql-host=127.0.0.1 --mysql-port=3306 --mysql-user=root --mysql-password=yourpassword --mysql-db=tpcc --range_size=100 --table_size=100000 --tables=10 --threads=1 --time=0 prepare
```
上述命令中,你需要替换 `yourpassword` 为你的 MySQL 数据库密码。
运行 `TPCC` 测试:
```bash
sysbench --db-driver=mysql --mysql-host=127.0.0.1 --mysql-port=3306 --mysql-user=root --mysql-password=yourpassword --mysql-db=tpcc --range_size=100 --table_size=100000 --tables=10 --threads=32 --time=300 run
```
上述命令中,你需要替换 `yourpassword` 为你的 MySQL 数据库密码。这里我设置了 `threads` 为 32, `time` 为 300 秒,你可以根据你的需要进行调整。
完成测试后,你可以清理 `tpcc` 数据库:
```bash
sysbench --db-driver=mysql --mysql-host=127.0.0.1 --mysql-port=3306 --mysql-user=root --mysql-password=yourpassword --mysql-db=tpcc cleanup
```
注意:在执行 TPCC 测试之前,你需要先在 MySQL 数据库中创建一个名为 `tpcc` 的数据库。
在ubuntu20.04下如何使用 sysbench 跑 tpcc 测试,500仓,每次跑5分钟
首先,需要安装 sysbench 和 MySQL 数据库。在 Ubuntu 20.04 上可以使用以下命令安装:
```
sudo apt-get update
sudo apt-get install sysbench mysql-server
```
接下来,创建一个名为 `tpcc` 的数据库和一个新用户,授权该用户访问该数据库:
```
sudo mysql
CREATE DATABASE tpcc;
CREATE USER 'tpccuser'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON tpcc.* TO 'tpccuser'@'localhost';
FLUSH PRIVILEGES;
exit;
```
然后,下载 TPC-C 测试脚本:
```
wget https://raw.githubusercontent.com/Percona-Lab/sysbench-tpcc/master/create_table.sql
wget https://raw.githubusercontent.com/Percona-Lab/sysbench-tpcc/master/tpcc.lua
```
使用以下命令创建表并填充数据:
```
sudo mysql tpcc < create_table.sql
sysbench tpcc.lua --mysql-db=tpcc --mysql-user=tpccuser --mysql-password=password --mysql-host=localhost --mysql-port=3306 --report-interval=10 --time=300 --threads=64 --tables=10 --scale=500 prepare
```
最后,运行测试:
```
sysbench tpcc.lua --mysql-db=tpcc --mysql-user=tpccuser --mysql-password=password --mysql-host=localhost --mysql-port=3306 --report-interval=10 --time=300 --threads=64 --tables=10 --scale=500 run
```
这将在 64 个线程下运行 5 分钟的 TPC-C 测试。