sysbench github地址:https://github.com/akopytov/sysbench
sysbench安装:
curl -s https://packagecloud.io/install/repositories/akopytov/sysbench/script.rpm.sh | sudo bash
sudo yum -y install sysbench
源码安装:
Building and Installing From Source
yum -y install make automake libtool pkgconfig libaio-devel
# For MySQL support, replace with mysql-devel on RHEL/CentOS 5
yum -y install mariadb-devel openssl-devel
# For PostgreSQL support
yum -y install postgresql-devel
./autogen.sh
# Add --with-pgsql to build with PostgreSQL support
./configure
make -j
make install
sysbench测试过程
lua脚本位置(指定测试用例)
find / -name oltp.lua
/usr/share/sysbench/tests/include/oltp_legacy
1、数据准备阶段
# sysbench /usr/share/sysbench/tests/include/oltp_legacy/oltp.lua --mysql-table-engine=innodb --table_size=100000 --threads=20 --oltp-tables-count=3 --mysql-db=test --mysql-user=root --mysql-host=localhost --mysql-password=MyNewPass4! prepare
2、数据测试阶段
# sysbench /usr/share/sysbench/tests/include/oltp_legacy/oltp.lua --mysql-table-engine=innodb --oltp-table-size=1000000 --oltp-tables-count=3 --mysql-db=test --mysql-user=root --mysql-host=localhost --mysql-password=MyNewPass4! --time=60 --max-requests=0 --threads=8 --report-interval=10 run
--threads=8 //线程数为8
--time=60 //测试时间为60s
--report-interval=10 //报告打印周期为10s,每10s打印一次
--oltp-read-only=off //非只读操作测试
3、数据清理阶段
# sysbench /usr/share/sysbench/tests/include/oltp_legacy/oltp.lua --mysql-table-engine=innodb --oltp-tables-count=3 --oltp-table-size=1000000 --mysql-user=root --mysql-host=localhost --mysql-password=MyNewPass4! cleanup
下次再仔细分析下测试结果。
原文:https://blog.51cto.com/sugarlovecxq/2525354