一、安装
1、安装包准备
需要下载 sysbench 的源码进行编译安装。因为我是要测试 Oracle 的,需要编译安装对应的模块,sysbench 默认支持 mysql,且只有 0.5 的版本支持 Oracle。
GitHub - akopytov/sysbench at 0.5
sysbench的编译安装依赖 make m4 autoconf automake libtool pkgconfig libaio-devel。
其中比较困难的是安装 perl(autoconf与automake需要),打包的安装包集锦如下:
链接:https://pan.baidu.com/s/1mL6OyTAU8JzWd5ZKmOlv0g
提取码:yzol
其他的包安装都很顺利,也不需要依赖其他的包:
https://mirrors.aliyun.com/centos/7.9.2009/os/x86_64/Packages/libaio-devel-0.3.109-13.el7.x86_64.rpm?spm=a2c6h.13651111.0.0.26c62f704qzTlE&file=libaio-devel-0.3.109-13.el7.x86_64.rpm
https://mirrors.aliyun.com/centos/7.9.2009/os/x86_64/Packages/libtool-2.4.2-22.el7_3.x86_64.rpm?spm=a2c6h.13651111.0.0.26c62f704qzTlE&file=libtool-2.4.2-22.el7_3.x86_64.rpm
https://mirrors.aliyun.com/centos/7.9.2009/os/x86_64/Packages/automake-1.13.4-3.el7.noarch.rpm?spm=a2c6h.13651111.0.0.26c62f704qzTlE&file=automake-1.13.4-3.el7.noarch.rpm
https://mirrors.aliyun.com/centos/7.9.2009/os/x86_64/Packages/autoconf-2.69-11.el7.noarch.rpm?spm=a2c6h.13651111.0.0.26c62f704qzTlE&file=autoconf-2.69-11.el7.noarch.rpm
https://mirrors.aliyun.com/centos/7.9.2009/os/x86_64/Packages/m4-1.4.16-10.el7.x86_64.rpm?spm=a2c6h.13651111.0.0.26c62f704qzTlE&file=m4-1.4.16-10.el7.x86_64.rpm
https://mirrors.aliyun.com/centos/7.9.2009/os/x86_64/Packages/pkgconfig-0.27.1-4.el7.x86_64.rpm?spm=a2c6h.13651111.0.0.516b2f70GzO1ZM&file=pkgconfig-0.27.1-4.el7.x86_64.rpm
https://mirrors.aliyun.com/centos/7.9.2009/os/x86_64/Packages/make-3.82-24.el7.x86_64.rpm?spm=a2c6h.13651111.0.0.516b2f70GzO1ZM&file=make-3.82-24.el7.x86_64.rpm
2、安装流程
2.1 导入环境变量
安装过程中需要的一些环境变量:
[root@localhost sysbench-0.5]# export CC=cc
[root@localhost sysbench-0.5]# export CXX=c++
[root@localhost sysbench-0.5]# export CFLAGS="-m64 -I /Oracle/oracle/product/11.2.0.3/dbname/rdbms/public"
[root@localhost sysbench-0.5]# export CXXFLAGS="$CFLAGS"
[root@localhost sysbench-0.5]# export ORACLE_HOME=/Oracle/oracle/product/11.2.0.3/dbname
[root@localhost sysbench-0.5]# export LD_LIBRARY_PATH=/Oracle/oracle/product/11.2.0.3/dbname/lib/
上面唯一需要注意的就是获取 ORACLE_HOME 并替换掉 CFALGS、ORACLE_HOME、LD_LIBRARY_PATH 中oracle目录。
[oracle@localhost ~]$ echo $ORACLE_HOME
/Oracle/oracle/product/11.2.0.3/dbname
2.2 配置、编译安装
# 运行autogen.sh,生成configure目录
[root@localhost sysbench-0.5]# ./autogen.sh
./autogen.sh: running `aclocal -I m4'
./autogen.sh: running `libtoolize --copy --force'
libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, `config'.
libtoolize: copying file `config/ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
libtoolize: copying file `m4/libtool.m4'
libtoolize: copying file `m4/ltoptions.m4'
libtoolize: copying file `m4/ltsugar.m4'
libtoolize: copying file `m4/ltversion.m4'
libtoolize: copying file `m4/lt~obsolete.m4'
./autogen.sh: running `autoheader'
./autogen.sh: running `automake -c --foreign --add-missing'
configure.ac:27: installing 'config/ar-lib'
configure.ac:25: installing 'config/compile'
configure.ac:11: installing 'config/config.guess'
configure.ac:11: installing 'config/config.sub'
configure.ac:16: installing 'config/install-sh'
configure.ac:16: installing 'config/missing'
sysbench/Makefile.am: installing 'config/depcomp'
parallel-tests: installing 'config/test-driver'
./autogen.sh: running `autoconf'
Libtoolized with: libtoolize (GNU libtool) 2.4.2
Automade with: automake (GNU automake) 1.13.4
Configured with: autoconf (GNU Autoconf) 2.69
# 编译参数设置
[root@localhost sysbench-0.5]# ./configure --prefix=/usr/local/sysbench --with-oracle --libdir=/oracle/app/product/193000/db_1/lib --without-mysql
# 编译及安装
[root@localhost sysbench-0.5]# make ORA_LIBS=/Oracle/oracle/product/11.2.0.3/dbname/lib/libclntsh.so
[root@localhost sysbench-0.5]# make install
2.3 设置环境变量
echo "export PATH=$PATH:/usr/local/sysbench/bin">>/etc/profile
source /etc/profile
到此安装成功了,可以查看sysbench版本检查一下是否安装成功。