sysbench 依赖的包: m4 autoconf automake libtool
yum install m4 autoconf automake libtool
安装:
tar zxvf sysbench-0.5.tar.gz
cd sysbench-0.5
chmod +x autogen.sh
./autogen.sh
./configure --with-mysql-includes=/usr/local/mysql/include --with-mysql-libs=/usr/local/mysql/lib
make & make install
构造数据:
sysbench --test=/usr/local/src/sysbench-0.5/sysbench/tests/db/oltp.lua --oltp_secondary=on --oltp_tables_count=10 --oltp-table-size=2000000 --db-driver=mysql --mysql-user=root --mysql-password=‘superdata123‘ --mysql-port=3306 --mysql-host=‘localhost‘ --mysql-db=test prepare
测试:
sysbench --test=/usr/local/src/sysbench-0.5/sysbench/tests/db/oltp.lua --oltp-read-only=off --init-rng=on --num-threads=100 --max-requests=200000 --oltp-dist-type=uniform --max-time=1800 --mysql-user=superdata --oltp-table-size=2000000 --oltp_tables_count=10 --rand-init=on --mysql-password=‘xxxx‘ --mysql-port=3306 --mysql-host=‘xxxxx‘ --db-driver=mysql --mysql-db=test run
--oltp-read-only=on 只测试读
--init-rng=on 在测试开始时是否初始化随机发生器,默认是off
--num-thread 多少个并发连接线程
报错信息:
sysbench: error while loading shared libraries: libmysqlclient.so.18: cannot open shared object file: No such file or directory
export LD_LIBRARY_PATH=/usr/local/mysql/lib 输出这个变量即可
测试结果分析