May you do good and not evil.
May you find forgiveness for yourself and forgive others.
May you share freely, never taking more than you give.
1.使用git下载源码
2.编译tpcc-mysql
cd tpcc-mysql/src
make
在编译时候可能遇到的问题及解决办法:
2.1 undefined reference to `mysql_init' 形式的未定义mysql_xxx问题
2.2 can't find mysql.h 问题
解决办法:
[root@localhost ShareDevil]# yum search mysql | grep head
mysql++-devel.x86_64 : MySQL++ developer files (headers, examples, etc.)
mysql-community-devel.i686 : Development header files and libraries for MySQL
mysql-community-devel.x86_64 : Development header files and libraries for MySQL
mysql-connector-c++-devel.x86_64 : Development header files and libraries for
dmlite-dpmhead.x86_64 : EMI DPM Head Node (MySQL)
dmlite-dpmhead-domeonly.x86_64 : DPM Head Node (MySQL)
[root@localhost ShareDevil]# yum install mysql-community-devel.x86_64 //安装开发依赖库和头文件
3.使用tpcc-mysql
3.1 准备工作
[root@localhost tpcc-mysql]# mysql -uroot -p -e "create database tpcc" # 创建测试用的数据库
[root@localhost tpcc-mysql]# mysql -uroot -p tpcc < create_table.sql # 创建测试用的表
[root@localhost tpcc-mysql]# mysql -uroot -p tpcc < add_fkey_idx.sql # 创建FK和索引
3.2 创建五个数据仓库
./tpcc_load -h127.0.0.1 -dtpcc -uroot -prootpasswd -w5
3.3 测试
./tpcc_start -h 127.0.0.1 -P 3306 -d tpcc -u root -p rootpasswd -w 5 -c 5 -r 120 -l 300 - >tpcc-output-log
各个参数用法如下:
-h server_host: 服务器名
-P port : 端口号,默认为3306
-d database_name: 数据库名
-u mysql_user : 用户名
-p mysql_password : 密码
-w warehouses: 仓库的数量
-c connections : 线程数,默认为1
-r warmup_time : 热身时间,单位:s,默认为10s , 热身是为了将数据加载到内存。(真实测试中建议热身时间不低于5分钟)
-l running_time: 测试时间,单位:s,默认为20s
-i report_interval: 指定生成报告间隔时长(真实测试中不低于30min)
-f report_file: 测试结果输出文件(一般命名为xxx.log)
-t trx:输出文件
- > out1: 将控制台输出存入文件out1中