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