1.sysbench版本为sysbench-0.4.10.tar.gzmysql
依赖软件:yum install gcc gcc-c++ libtool -y
c++
2.编译安装sysbenchsql
2.1 解压sysbench压缩包shell
[root@master opt]# tar xvf sysbench-0.4.10.tar.gz
2.2 编译sysbench,由于个人mysql时编译安装的因此参数中要指定mysql位置,若是是rmp版的mysql则不须要指定,直接./configure进行编译app
[root@master ~]# cd /opt/sysbench-0.4.10 [root@master sysbench-0.4.10]# ./autogen.sh [root@master sysbench-0.4.10]# ./configure --with-mysql-includes=/usr/local/mysql/include/ --with-mysql-libs=/usr/local/mysql/lib/
2.3 安装sysbench测试
[root@master sysbench-0.4.10]# make && make install
在make时可能出现以下错误:ui
../libtool: line 838: X--tag=CC: command not found ../libtool: line 871: libtool: ignoring unknown tag : command not found ../libtool: line 838: X--mode=link: command not found ../libtool: line 1004: *** Warning: inferring the mode of operation is deprecated.: command not found ../libtool: line 1005: *** Future versions of Libtool will require --mode=MODE be specified.: command not found ../libtool: line 2231: X-g: command not found ../libtool: line 2231: X-O2: command not found
解决办法:lua
[root@master sysbench-0.4.10]# export echo=echo
2.4 测试是否能够使用sysbenchcode
[root@master sysbench-0.4.10]# sysbench --test=cpu --cpu-max-prime=20000 run
此处有可能报错:orm
sysbench: error while loading shared libraries: libmysqlclient.so.18: cannot open shared object file: No such file or directory
解决办法:
[root@master sysbench-0.4.10]# echo "/usr/local/mysql/lib" >>/etc/ld.so.conf&&ldconfig
再进行测试也就会成功:
[root@master opt]# sysbench --test=cpu --cpu-max-prime=20000 run sysbench 0.4.10: multi-threaded system evaluation benchmark Running the test with following options: Number of threads: 1 Doing CPU performance benchmark Threads started! Done. Maximum prime number checked in CPU test: 20000 Test execution summary: total time: 25.0387s total number of events: 10000 total time taken by event execution: 24.9995 per-request statistics: min: 1.65ms avg: 2.50ms max: 5.86ms approx. 95 percentile: 2.97ms Threads fairness: events (avg/stddev): 10000.0000/0.00 execution time (avg/stddev): 24.9995/0.00