一、安装
我的安装过程去官网上面下载下源码,然后安装。
系统:CentOS release 5.3
安装过程首先运行autogen.sh
然后通过locate mysql找到mysql的include和lib的位置
./configure --prefix=/usr/sysbench --with-mysql-includes=/usr/include/mysql/ --with-mysql-libs=/usr/lib64/mysql/
make
make install
二、使用
在使用之前必须创建好数据库,可以创建成默认的sbtest,然后就不用指定该参数了,下面是官方文档中关于这个参数的说明:
--mysql-db | MySQL database name. Note SysBench will not automatically create this database. You should create it manually and grant the appropriate privileges to a user which will be used to access the test table. | sbtest |
假如没有创建的话,sysbench会报错,提示:
FATAL: unable to connect to MySQL server, aborting...
FATAL: error 1049: Unknown database 'sbtest'
FATAL: failed to connect to database server!
害我检查了半天,以为是用户名和密码的问题
具体使用以及参数可以参照下面的文章:
http://www.ningoo.net/html/2009/performance_test_tool_sysbench.html
下面是我的prepare过程
/usr/sysbench/bin/sysbench --debug=off --test=oltp --mysql-table-engine=innodb --oltp-table-size=2000000 --mysql-socket=/data/mysql/ha_master/mysql.sock --num-threads=8 --max-requests=0 --mysql-user=root --mysql-password=*** --mysql-host=localhost prepare