1.下载源码 tpcc-mysql-src.tgz
2.解压 tpcc-mysql-src.tgz
3.安装
[[email protected] mysql]# cd /home/mysql/tpcc-mysql/src [[email protected] src]# export PATH=/usr/local/mysql/bin:$PATH [[email protected] src]# make cc -w -O2 -g -I. `mysql_config --include` -c load.c cc -w -O2 -g -I. `mysql_config --include` -c support.c cc load.o support.o `mysql_config --libs_r` -lrt -o ../tpcc_load cc -w -O2 -g -I. `mysql_config --include` -c main.c cc -w -O2 -g -I. `mysql_config --include` -c spt_proc.c cc -w -O2 -g -I. `mysql_config --include` -c driver.c cc -w -O2 -g -I. `mysql_config --include` -c sequence.c cc -w -O2 -g -I. `mysql_config --include` -c rthist.c cc -w -O2 -g -I. `mysql_config --include` -c neword.c cc -w -O2 -g -I. `mysql_config --include` -c payment.c cc -w -O2 -g -I. `mysql_config --include` -c ordstat.c cc -w -O2 -g -I. `mysql_config --include` -c delivery.c cc -w -O2 -g -I. `mysql_config --include` -c slev.c cc main.o spt_proc.o driver.o support.o sequence.o rthist.o neword.o payment.o ordstat.o delivery.o slev.o `mysql_config --libs_r` -lrt -o ../tpcc_start [[email protected] src]#
4.创建数据库导入预定脚本
[[email protected] tpcc-mysql]$ mysqladmin --defaults-file=/data/mysqldata/my.cnf -uroot -p123456 -P3306 -h192.168.0.45 create tpcc Warning: Using a password on the command line interface can be insecure. [[email protected] tpcc-mysql]$ mysql --defaults-file=/data/mysqldata/my.cnf -uroot -p123456 -P3306 -h192.168.0.45 mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | test | | tpcc | +--------------------+ mysql> 导入预定脚本: mysql> use tpcc Database changed mysql> show variables like ‘%storage_engine%‘; +----------------------------+--------+ | Variable_name | Value | +----------------------------+--------+ | default_storage_engine | InnoDB | | default_tmp_storage_engine | InnoDB | | storage_engine | InnoDB | +----------------------------+--------+ 3 rows in set (0.10 sec) mysql> source /home/mysql/tpcc-mysql/create_table.sql #注意脚本的执行权限 mysql> source /home/mysql/tpcc-mysql/add_fkey_idx.sql
5.初始化数据(不用指定端口号)
[[email protected] tpcc-mysql]$ ./tpcc_load 192.168.0.45 tpcc root 123456 10 ************************************* *** ###easy### TPC-C Data Loader *** ************************************* <Parameters> [server]: 192.168.0.45 [port]: 3306 [DBname]: tpcc [user]: root [pass]: 123456 [warehouse]: 10 TPCC Data Load Started... Loading Item .................................................. 5000 .................................................. 10000 .................................................. 15000 .................................................. 20000 很长很长世间 Orders Done. Loading Orders for D=10, W= 10 .......... 1000 .......... 2000 .......... 3000 Orders Done. ...DATA LOADING COMPLETED SUCCESSFULLY. [[email protected] tpcc-mysql]$
6.进行测试
[[email protected] tpcc-mysql]$ ./tpcc_start --help *************************************** *** ###easy### TPC-C Load Generator *** *************************************** ./tpcc_start: invalid option -- - Usage: tpcc_start -h server_host -P port -d database_name -u mysql_user -p mysql_password -w warehouses -c connections -r warmup_time -l running_time -i report_interval -f report_file -t trx_file [[email protected] tpcc-mysql]$ ./tpcc_start -h 192.168.0.45 -P 3306 -d tpcc -u root -p 123456 -w 10 -c 10 -r 100 -l 300 -f /home/mysql/tpcc-mysql.log -t /home/mysql/tpcc_mysql.rtx
时间: 2024-11-09 00:07:28