此次实验的环境如下
推荐不要在安装有MySQL服务的机器上安装,而是在单独的机器上安装
yum -y install make automake libtool pkgconfig libaio-devel
# For MySQL support, replace with mysql-devel on RHEL/CentOS 5
yum -y install mariadb-devel openssl-devel
rpm -ql mariadb-devel
# For PostgreSQL support
yum -y install postgresql-devel
https://github.com/akopytov/sysbench
或者通过下面百度云下载
链接: https://pan.baidu.com/s/1W3lysCQdZDooU9ltXuoAdg 提取码: m73e
root用户
unzip sysbench-master.zip
cd sysbench-master/
./autogen.sh
./configure --prefix=/usr/sysbench/ --with-mysql-includes=/usr/include/mysql/ --with-mysql-libs=/usr/lib64/mysql/ -with-pgsql
make -j
make install
这里我们通过-with-mysql-includes 和--with-mysql-libs指定mysql相关文件位置
可通过rpm -ql mariadb-devel命令查看
-with-pgsql代表添加postgresql的支持,注意需要先安装pg相关的包
--prefix 代表sysbench安装的位置
最后将命令加入到环境变量中
PATH=$PATH:$HOME/bin:/usr/sysbench/bin
sysbench --help
我们可以在/usr/sysbench目录下看到两个目录
bin目录下为sysbench的二进制命令
share目录下为自带的一些测试脚本