目录
MySQL数据库性能基准测试之sysbench之2—sysbench下载安装
一、sysbench下载
1、sysbench下载
(1)官方下载
https://github.com/akopytov/sysbench
(2)站内下载
若国内无法打开,可以使用作者站内地址:
https://download.topunix.com/MySQL/Software-sysbench/sysbench-1.0.20.tar.gz
2、关于sysbench安装平台
目前版本官方1.0只提供linux/unix下的安装部署,windows平台已经不支持,目前尚不清楚未来是否会重新支持。
二、sysbench安装
1、下载
mkdir /sysbench cd /sysbench wget https://download.topunix.com/MySQL/Software-sysbench/sysbench-1.0.20.tar.gz
2、安装依赖
yum install make automake libtool pkgconfig libaio-devel openssl-devel
3、安装软件
(1)解压软件
cd /sysbench tar zxvf sysbench-1.0.20.tar.gz cd sysbench-1.0.20
(2)安装软件
./autogen.sh ./configure --此处默认安装路径为/usr/local相关文件在/usr/local/bin和/usr/local/share中,ye可以执行安装目录./configure --prefix=/mysql/sysbench make -j ---j代表并行执行,因sysbench较小,不加-j也可以。 make install
安装完成。
(3)配置变量并生效
vi ~/.bash_profile export PATH=$PATH:/mysql/sysbench/bin
source ~/.bash_profile
4、安装完成,查看help
sysbench --help
5、可能的报错解决
执行sysbench命令,如果出现如下报错:
sysbench: error while loading shared libraries: libmysqlclient.so.20: cannot open shared object file: No such file or directory
找不到共享库文件libmysqlclient.so.20.
(1)找到文件所在:
[root@mysql161 /]# find / -name 'libmysqlclient*'
/usr/lib64/mysql/libmysqlclient.so.18
/usr/lib64/mysql/libmysqlclient.so.18.0.0
/mysql/app/mysql/lib/libmysqlclient.a
/mysql/app/mysql/lib/libmysqlclient.so
/mysql/app/mysql/lib/libmysqlclient.so.20
/mysql/app/mysql/lib/libmysqlclient.so.20.3.27
(2)指向软连接
ln -s /mysql/app/mysql/lib/libmysqlclient.so.20 /usr/local/lib/libmysqlclient.so.20
(3)配置ld.so.conf
vi /etc/ld.so.conf 最后一行增加:/usr/local/lib
(4)生效配置
/sbin/ldconfig -v
(5)再执行sysbench即可解决
sysbench --help
[root@mysql161 /]# sysbench --help Usage: sysbench [options]... [testname] [command] Commands implemented by most tests: prepare run cleanup help General options: --threads=N number of threads to use [1] --events=N limit for total number of events [0] --time=N limit for total execution time in seconds [10] --forced-shutdown=STRING number of seconds to wait after the --time limit before forcing shutdown, or 'off' to disable [off] --thread-stack-size=SIZE size of stack per thread [64K] --rate=N average transactions rate. 0 for unlimited rate [0] --report-interval=N periodically report intermediate statistics with a specified interval in seconds. 0 disables intermediate reports [0] --report-checkpoints=[LIST,...] dump full statistics and reset all counters at specified points in time. The argument is a list of comma-separated values representing the amount of time in seconds elapsed from start of test when report checkpoint(s) must be performed. Report checkpoints are off by default. [] --debug[=on|off] print more debugging info [off] --validate[=on|off] perform validation checks where possible [off] --help[=on|off] print help and exit [off] --version[=on|off] print version and exit [off] --config-file=FILENAME File containing command line options --tx-rate=N deprecated alias for --rate [0] --max-requests=N deprecated alias for --events [0] --max-time=N deprecated alias for --time [0] --num-threads=N deprecated alias for --threads [1] Pseudo-Random Numbers Generator options: --rand-type=STRING random numbers distribution {uniform,gaussian,special,pareto} [special] --rand-spec-iter=N number of iterations used for numbers generation [12] --rand-spec-pct=N percentage of values to be treated as 'special' (for special distribution) [1] --rand-spec-res=N percentage of 'special' values to use (for special distribution) [75] --rand-seed=N seed for random number generator. When 0, the current time is used as a RNG seed. [0] --rand-pareto-h=N parameter h for pareto distribution [0.2] Log options: --verbosity=N verbosity level {5 - debug, 0 - only critical messages} [3] --percentile=N percentile to calculate in latency statistics (1-100). Use the special value of 0 to disable percentile calculations [95] --histogram[=on|off] print latency histogram in report [off] General database options: --db-driver=STRING specifies database driver to use ('help' to get list of available drivers) [mysql] --db-ps-mode=STRING prepared statements usage mode {auto, disable} [auto] --db-debug[=on|off] print database-specific debug information [off] Compiled-in database drivers: mysql - MySQL driver mysql options: --mysql-host=[LIST,...] MySQL server host [localhost] --mysql-port=[LIST,...] MySQL server port [3306] --mysql-socket=[LIST,...] MySQL socket --mysql-user=STRING MySQL user [sbtest] --mysql-password=STRING MySQL password [] --mysql-db=STRING MySQL database name [sbtest] --mysql-ssl[=on|off] use SSL connections, if available in the client library [off] --mysql-ssl-cipher=STRING use specific cipher for SSL connections [] --mysql-compression[=on|off] use compression, if available in the client library [off] --mysql-debug[=on|off] trace all client library calls [off] --mysql-ignore-errors=[LIST,...] list of errors to ignore, or "all" [1213,1020,1205] --mysql-dry-run[=on|off] Dry run, pretend that all MySQL client API calls are successful without executing them [off] Compiled-in tests: fileio - File I/O test cpu - CPU performance test memory - Memory functions speed test threads - Threads subsystem performance test mutex - Mutex performance test See 'sysbench <testname> help' for a list of options for each test.