编程开源技术交流,分享技术与知识

网站首页 > 开源技术 正文

sysbench使用(sysbench oltp)

wxchong 2024-06-30 10:54:58 开源技术 14 ℃ 0 评论

1 安装

curl -s https://packagecloud.io/install/repositories/akopytov/sysbench/script.rpm.sh
复制内容到一个脚本中,然后执行脚本
[root@db01 ~]# sh sysbench.sh 
然后执行
[root@db01 ~]# yum -y install sysbench

2 使用

语法:

sysbench [options]... [testname] [command]



查看对应的lua脚本

[root@db01 ~]# ll /usr/local/share/sysbench/
总用量 60
-rwxr-xr-x 1 root root  1452 10月 29 2020 bulk_insert.lua
-rw-r--r-- 1 root root 14369 10月 29 2020 oltp_common.lua
-rwxr-xr-x 1 root root  1290 10月 29 2020 oltp_delete.lua
-rwxr-xr-x 1 root root  2415 10月 29 2020 oltp_insert.lua
-rwxr-xr-x 1 root root  1265 10月 29 2020 oltp_point_select.lua
-rwxr-xr-x 1 root root  1649 10月 29 2020 oltp_read_only.lua
-rwxr-xr-x 1 root root  1824 10月 29 2020 oltp_read_write.lua
-rwxr-xr-x 1 root root  1118 10月 29 2020 oltp_update_index.lua
-rwxr-xr-x 1 root root  1127 10月 29 2020 oltp_update_non_index.lua
-rwxr-xr-x 1 root root  1440 10月 29 2020 oltp_write_only.lua
-rwxr-xr-x 1 root root  1919 10月 29 2020 select_random_points.lua
-rwxr-xr-x 1 root root  2118 10月 29 2020 select_random_ranges.lua
drwxr-xr-x 4 root root    49 10月 29 2020 tests

测试

针对oltp事务进行压测(prepare(装载数据)-->run(运行)-->cleanup(清除数据))
查看对应oltp脚本的帮助:
sysbench '/usr/local/share/sysbench/oltp_insert.lua' help
数据准备:
sysbench  --test='/usr/local/share/sysbench/oltp_insert.lua' --mysql-host=10.2.4.179 --mysql-port=3306 --mysql-user=lzm --mysql-password=123 --mysql-db=test --table_size=10000000 --tables=1   prepare
运行:
sysbench  --test='/usr/local/share/sysbench/oltp_insert.lua' --mysql-host=10.2.4.179 --mysql-port=3306 --mysql-user=lzm --mysql-password=123 --mysql-db=test --table_size=10000000 --tables=1   run
清除数据:
sysbench  --test='/usr/local/share/sysbench/oltp_insert.lua' --mysql-host=10.2.4.179 --mysql-port=3306 --mysql-user=lzm --mysql-password=123 --mysql-db=test --table_size=10000000 --tables=1   cleanup

Tags:

本文暂时没有评论,来添加一个吧(●'◡'●)

欢迎 发表评论:

最近发表
标签列表