当前位置: 首页 > 工具软件 > SysBench > 使用案例 >

sysbench

阎晋
2023-12-01

壹,安装篇
国内下载地址
csdn
本次使用的版本是1.0.16
安装依赖

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
# For PostgreSQL support
yum -y install postgresql-devel

下载sysbench
安装sysbench

unzip sysbench-1.0.16.zip 
cd sysbench-1.0.16
./autogen.sh
# Add --with-pgsql to build with PostgreSQL support
./configure
make -j
make install

报错:

[root@localhost ~]# sysbench --help
sysbench: error while loading shared libraries: libmysqlclient.so.20: cannot open shared object file: No such file or directory
###解决方法
find /  -name 'libmysqlclient*'
ln -s /usr/local/mysql-5.7.26-linux-glibc2.12-x86_64/lib/libmysqlclient.so.20 /usr/local/lib/libmysqlclient.so.20
vim /etc/ld.so.conf
/usr/local/lib                #写入
/sbin/ldconfig -v

检查是否安装成功

# sysbench --version
sysbench 1.0.16

sysbench 对 mysql io 进行压测
准备测试数据

##创建测试数据库,五表每张表一千万数据,共计五千万条数据
sysbench --mysql-host=127.0.0.1 \
--mysql-port=3306 \
--mysql-user=root \
--mysql-password=123456 \
--mysql-socket= /tmp/mysql_3306.sock  \
--test=/usr/local/share/sysbench/oltp_common.lua  \
--tables=5 \
--table_size=10000000 \
prepare

读写性能测试

##测试读写性能
sysbench --threads=4  \
--time=20 \
--report-interval=5 \
--mysql-host=127.0.0.1  \
--mysql-port=3306 \
--mysql-user=root \
--mysql-password=123456 \
/usr/local/share/sysbench/oltp_read_write.lua \
--tables=5 \
--table_size=10000000 \
run
 类似资料:

相关阅读

相关文章

相关问答