sysben笔记;
1、安装:
参考url:https://github.com/akopytov/sysbench#general-syntax
RHEL / CentOS的:
curl -s https://packagecloud.io/install/repositories/akopytov/sysbench/script.rpm.sh | sudo bash
sudo yum -y install sysbench
2、常规通用参数:
https://github.com/akopytov/sysbench#general-syntax 登录后通过chrome浏览器翻译后查看。
--threads 要创建的工作线程总数
--time 限制总执行时间(以秒为单位)。0表示没有限制
。。。。。。
3、命令结构:
sysbench [options]... [testname] [command]
[options]:通用参数,如--threads=16 --time=20
[testname]:要测试的模块或脚本。fileio,cpu,/usr/share/sysbench/oltp_write_only.lua等。脚本查看方式:shell> ls /usr/share/sysbench/
[command]:具体命令。prepare run cleanup help 。prepare:准备主句。run:执行。cleanup:清空测试数据。help:testname或脚本的帮助。
测试准备脚本:
1、手动创建sbtest数据库并付权。
2、查看目标脚本参数:shell> sysbench /usr/share/sysbench/oltp_write_only.lua help #查看脚本需要的特殊参数。
3、准备数据。
sysbench --time=20 --threads=32 --mysql-host=112.35.98.127 --mysql-port=3306 --mysql-user=root --mysql-password=xxxxxx /usr/share/sysbench/oltp_write_only.lua prepare
4、执行测试
sysbench --time=20 --threads=32 --mysql-host=112.35.98.127 --mysql-port=3306 --mysql-user=root --mysql-password=xxxxxx /usr/share/sysbench/oltp_write_only.lua run
5、清除测试数据
sysbench --time=20 --threads=32 --mysql-host=112.35.98.127 --mysql-port=3306 --mysql-user=root --mysql-password=xxxxxx /usr/share/sysbench/oltp_write_only.lua cleanup
参考链接:
https://blog.csdn.net/oahz4699092zhao/article/details/53332105