MySQL 测试工具 sysbench

1、配置 epel 源安装 sysbench

yum install -y sysbench

2、初始化数据

sysbench /usr/share/sysbench/tests/include/oltp_legacy/oltp.lua \
--mysql-host=192.168.1.226 \
--mysql-port=3306 \
--mysql-user=root \
--mysql-password=MySQL5.7 \
--oltp-test-mode=complex \
--oltp-tables-count=10 \
--oltp-table-size=100000 \
--threads=10 \
--time=120 \
--report-interval=10 \
--db-driver=mysql prepare

3、执行测试

sysbench /usr/share/sysbench/tests/include/oltp_legacy/oltp.lua \
--mysql-host=192.168.1.226 \
--mysql-port=3306 \
--mysql-user=root \
--mysql-password=MySQL5.7 \
--oltp-test-mode=complex \
--oltp-tables-count=10 \
--oltp-table-size=100000 \
--threads=10 \
--time=120 \
--db-driver=mysql \
--report-interval=10 run 

4、清理数据

sysbench /usr/share/sysbench/tests/include/oltp_legacy/oltp.lua \
--mysql-host=192.168.1.226 \
--mysql-port=3306 \
--mysql-user=root \
--db-driver=mysql \
--oltp-tables-count=10 \
--mysql-password=MySQL5.7 cleanup

参考文档:https://www.cnblogs.com/kismetv/p/7615738.html