sysbench 下载地址 http://down.51cto.com/data/2451642
tar zxvf sysbench-0.5.tar.gz cd sysbench-0.5 chmod +x autogen.sh ./autogen.sh ./configure --with-mysql-includes=/usr/local/include --with-mysql-libs=/usr/local/lib make && make install
/*
--with-mysql-includes:
--with-mysql-libs: mysql的 lib 函数库 目录 libmysqlclient
*/
--MySQL-host=test.mysql.rds.aliyuncs.com
#数据库host
--mysql-port=3306 #数据库端口
--mysql-user=your_username #数据库用户名
--mysql-password=your_password #数据库密码
--mysql-db=your_db_for_test #数据库名
--oltp-tables-count=10 #模拟的表的个数,规格越高该值越大
--oltp-table-size=6000000 #模拟的每张表的行数,规格越高该值越大
--num-threads=50 #模拟的并发数量,规格越高该值越大
--max-requests=100000000 #最大请求次数
--max-time=20 #最大测试时间(与--max-requests只要有一个超过,则退出)
--report-interval=1 #每1秒打印一次当前的QPS等值
--test=/tmp/sysbench-0.5/sysbench/tests/db/oltp.lua #选用的测试脚本(lua),此脚本可以从sysbench-0.5源代码文件目录下找
[prepare | run | cleanup] #prepare准备数据,run执行测试,cleanup清理数据
sysbench --mysql-host=localhost --mysql-port=3306 --mysql-user=test --mysql-password=123456 --mysql-db=zb --oltp-tables-count=10 --oltp-table-size=1000000 --num-threads=20 --max-requests=100000000 --report-interval=1 --test=/root/test/sysbench-0.5/sysbench/tests/db/oltp.lua prepare
sysbench --mysql-host=localhost --mysql-port=3306 --mysql-user=test --mysql-password=123456 --mysql-db=zb --oltp-tables-count=10 --oltp-table-size=1000000 --num-threads=20 --max-requests=3000000000 --report-interval=1 --max-time=3600 --test=/root/test/sysbench-0.5/sysbench/tests/db/oltp.lua run
错误解决:
automake: warnings are treated as errors
https://www.cnblogs.com/shifu204/p/6367727.html
configure: error: *** pthread_once() is not available on this platform ***
https://blog.csdn.net/silenceray/article/details/70140708
/usr/bin/ld: cannot find -lmysqlclient_r
将文件 configure 中的 mysqlclient_r 修改为 mysqlclient
参考链接
https://blog.csdn.net/c_enhui/article/details/52465123