sysbench测试mysql与postgresql

--安装yum包 
yum -y install bzr libtool   

--对压缩包进行解
--注意不要在mysql的官网下载,因为其只支持mysql不支持pg
https://github.com/akopytov/sysbench/tree/0.4
tar zxf sysbench-0.4.12-1.1.tgz 
mv sysbench-0.4.12-1.1 sysbench
unzip -d sysbench sysbench-0.5.zip 

--如果MySQL不是安装在标准默认目录下,那么就还需要指定MySQL的路径
./autogen.sh  
mkdir -p /usr/local/sysbencd_0.5/log  

./configure --prefix=/usr/local/sysbencd_0.5 --with-mysql-includes=/usr/local/mysql/include --with-mysql-libs=/usr/local/mysql/lib
make && make install

./configure --prefix=/usr/local/sysbench/sysbench --with-mysql-includes=/usr/local/mysql/include --with-mysql-libs=/usr/local/mysql/lib

编译sysbench的问题
drv_pgsql.c:29:22: error: libpq-fe.h: No such file or directory
drv_pgsql.c:104: error: expected specifier-qualifier-list before ‘Oid’
编译时指定CFLAGS
CFLAGS="-L/usr/local/postgresql/9.3.4/lib -I/usr/local/postgresql/9.3.4/include -lpq" ./configure --prefix=/usr/local/sysbench/sysbench --with-gnu-ld --with-mysql --with-pgsql --enable-dependency-tracking --with-mysql-includes=/usr/local/mysql/include --with-mysql-libs=/usr/local/mysql/lib --with-pgsql-includes=/usr/local/postgresql/9.3.4/include --with-pgsql-libs=/usr/local/postgresql/9.3.4/lib

make时报错:
/usr/bin/ld: warning: libssl.so.1.0.0, needed by /usr/local/postgresql/9.3.4/lib/libpq.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libcrypto.so.1.0.0, needed by /usr/local/postgresql/9.3.4/lib/libpq.so, not found (try using -rpath or -rpath-link)
env LDFLAGS=-R/usr/local/postgresql/9.3.4/lib ./configure --prefix=/usr/local/sysbench/sysbench --with-gnu-ld --with-pgsql --enable-dependency-tracking  --with-pgsql-includes=/usr/local/postgresql/9.3.4/include --with-pgsql-libs=/usr/local/postgresql/9.3.4/lib

cp /usr/local/sysbencd_0.5/bin/sysbench /usr/local/bin/ 

cp -a /usr/local/sysbench/sysbench/tests /usr/local/sysbencd_0.5/ 

[root@mars sysbencd_0.5]# sysbench
sysbench: error while loading shared libraries: libmysqlclient.so.18: cannot open shared object file: No such file or directory
--sysbench无法找到mysql的库文件,这很可能是环境变量LD_LIBRARY_PATH没有设置,设置后即可解决该问题: 
[root@mars sysbencd_0.5]# export LD_LIBRARY_PATH=/usr/local/mysql/lib 

export LD_LIBRARY_PATH=/usr/local/mysql/lib 


./sysbench --test=oltp --oltp-table-size=1000 --mysql-host=127.0.0.1 --mysql-port=3306 --mysql-user=root --mysql-password=123456 --mysql-db=test --db-driver=mysql prepare

sysbench --mysql-host=127.0.0.1 --mysql-port=3306 --mysql-user=root --mysql-password='123456' --oltp-table-size=1000 --num-threads=8 --oltp-read-only=off run >> /tmp/sysbench_oltp.log

 Mysql数据库测试
 create database sbtest;

 sysbench --mysql-host=127.0.0.1 --mysql-port=3306 --mysql-user=root --mysql-password='laba!123' --test=/usr/local/sysbencd_0.5/tests/db/oltp.lua --oltp_tables_count=10 --oltp-table-size=1000 --rand-init=on prepare

# --test=tests/db/oltp.lua 表示调用 tests/db/oltp.lua 脚本进行 oltp 模式测试
# --oltp_tables_count=10 表示会生成 10 个测试表
# --oltp-table-size=100000 表示每个测试表数据行数
# --rand
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值