mysql 5.7.26
sysbench 1.1.0
一、创建测试库
create database sysbenchtest;
二、创建测试用户
grant all PRIVILEGES on sysbenchtest.* to sysbenchuser@'%' identified by 'sysbenchuser';
三、准备测试数据
# /usr/local/bin/sysbench /tmp/sysbench-master/src/lua/oltp_read_write.lua --mysql-user=sysbenchuser --mysql-password=sysbenchuser --mysql-port=3307 --mysql-host=localhost --mysql-socket=/tmp/mysqld.sock --mysql-db=sysbenchtest --tables=10 --table-size=5000000 --threads=30 --events=5000000 --report-interval=5 prepare
sysbench 1.1.0 (using bundled LuaJIT 2.1.0-beta3)
Initializing worker threads...
Creating table 'sbtest9'...
Creating table 'sbtest2'...
Creating table 'sbtest4'...
Creating table 'sbtest8'...
Creating table 'sbtest3'...
Creating table 'sbtest10'...
Creating table 'sbtest7'...
Creating table 'sbtest6'...
Creating table 'sbtest5'...
Creating table 'sbtest1'...
Inserting 5000000 records into 'sbtest2'
Inserting 5000000 records into 'sbtest6'
Inserting 5000000 records into 'sbtest4'
Inserting 5000000 records into 'sbtest7'
Inserting 5000000 records into 'sbtest3'
Inserting 5000000 records into 'sbtest9'
Inserting 5000000 records into 'sbtest8'
Inserting 5000000 records into 'sbtest5'
Inserting 5000000 records into 'sbtest10'
Inserting 5000000 records into 'sbtest1'
Creating a secondary index on 'sbtest2'...
Creating a secondary index on 'sbtest8'...
Creating a secondary index on 'sbtest9'...
Creating a secondary index on 'sbtest4'...
Creating a secondary index on 'sbtest7'...
Creating a secondary index on 'sbtest5'...
Creating a secondary index on 'sbtest3'...
Creating a secondary index on 'sbtest10'...
Creating a secondary index on 'sbtest1'...
Creating a secondary index on 'sbtest6'...
到此数据准备完毕,10张表,每张表500万条记录,接下来可以进行各种测试。