• sysbench安装部署for mysql


    1.解压
    unzip sysbench-1.0.zip
    mv sysbench-1.0 /opt/

    2.执行脚本
    [root@localhost sysbench-1.0]# ./autogen.sh

    3.编译
    ./configure --prefix=/usr/local/sysbencd_1.0 --with-mysql-includes=/opt/mysql5730/include --with-mysql-libs=/opt/mysql5730/lib
    make && make install

    4.使用
    /opt/mysql5730/bin/mysql -h localhost -uroot -pmysql

    /usr/local/sysbencd_1.0/bin/sysbench --mysql-host=127.0.0.1 --mysql-port=3306 --mysql-user=root --mysql-password='mysql' --test=/opt/sysbench-1.0/tests/include/oltp_legacy/oltp.lua --oltp_tables_count=10 --oltp-table-size=1000 --rand-init=on prepare

    /usr/local/sysbencd_1.0/bin/sysbench: error while loading shared libraries: libmysqlclient.so.20: cannot open shared object file: No such file or directory

    解决办法:
    加入环境变量
    LD_LIBRARY_PATH=/opt/mysql5730/lib:/opt/mha_software/share/perl5/MHA:$LD_LIBRARY_PATH

    创建10个表,每个表数据库1000
    [root@localhost ~]# /usr/local/sysbencd_1.0/bin/sysbench --mysql-host=127.0.0.1 --mysql-port=3306 --mysql-user=root --mysql-password='mysql' --test=/opt/sysbench-1.0/tests/include/oltp_legacy/oltp.lua --oltp_tables_count=10 --oltp-table-size=1000 --rand-init=on prepare
    WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options.
    sysbench 1.0.20 (using bundled LuaJIT 2.1.0-beta2)

    FATAL: unable to connect to MySQL server on host '127.0.0.1', port 3306, aborting...
    FATAL: error 1049: Unknown database 'sbtest'
    FATAL: `prepare' function failed: /opt/sysbench-1.0/tests/include/oltp_legacy/common.lua:111: Failed to connect to the database
    [root@localhost ~]#

    解决办法:
    create database sbtest;



    /usr/local/sysbencd_1.0/bin/sysbench --mysql-host=127.0.0.1 --mysql-port=3306 --mysql-user=root --mysql-password='mysql' --test=/opt/sysbench-1.0/tests/include/oltp_legacy/oltp.lua --oltp_tables_count=10 --oltp-table-size=1000 --rand-init=on prepare
    /usr/local/sysbencd_1.0/bin/sysbench --mysql-host=127.0.0.1 --mysql-port=3306 --mysql-user=root --mysql-password='mysql' --test=/opt/sysbench-1.0/tests/include/oltp_legacy/oltp.lua --oltp_tables_count=10 --oltp-table-size=1000 --num-threads=8 --oltp-read-only=off --report-interval=10 --rand-type=uniform --max-time=120 --max-requests=0 --percentile=99 run >> /tmp/sysbench_oltp.log
    # --num-threads=8 表示发起 8个并发连接
    # --oltp-read-only=off 表示不要进行只读测试,也就是会采用读写混合模式测试
    # --report-interval=10 表示每10秒输出一次测试进度报告
    # --rand-type=uniform 表示随机类型为固定模式,其他几个可选随机模式:uniform(固定),gaussian(高斯),special(特定的),pareto(帕累托)
    # --max-time=120 表示最大执行时长为 120秒
    # --max-requests=0 表示总请求数为 0,因为上面已经定义了总执行时长,所以总请求数可以设定为 0;也可以只设定总请求数,不设定最大执行时长
    # --percentile=99 表示设定采样比例,默认是 95%,即丢弃1%的长请求,在剩余的99%里取最大值


    --测试mysql
    /usr/local/sysbencd_1.0/bin/sysbench --test=/opt/sysbench-1.0/tests/include/oltp_legacy/oltp.lua --oltp-table-size=10000 --mysql-host=127.0.0.1 --mysql-port=3306 --mysql-user=root --mysql-password=mysql --mysql-db=db_test --db-driver=mysql prepare
    /usr/local/sysbencd_1.0/bin/sysbench --test=/opt/sysbench-1.0/tests/include/oltp_legacy/oltp.lua --max-requests=0 --max-time=60 --num-threads=16 --mysql-host=127.0.0.1 --mysql-port=3306 --mysql-user=root --mysql-password=mysql --mysql-db=db_test --db-driver=mysql --oltp-reconnect-mode=session --oltp-test-mode=simple run
    /usr/local/sysbencd_1.0/bin/sysbench --test=/opt/sysbench-1.0/tests/include/oltp_legacy/oltp.lua --mysql-host=127.0.0.1 --mysql-port=3306 --mysql-user=root --mysql-password=mysql --mysql-db=db_test --db-driver=mysql cleanup

  • 相关阅读:
    k8s--容器挂载 error: /proc must be mounted
    mysql--read only
    C#读取Excel文件(.xls .xlsx)
    如何使用BBCode
    markdown使用经验积累
    openlayers学习之-----入门篇
    echarts学习之----动态排序柱状图
    echarts学习之----多图例折线图
    Web3D学习之-----全景图预览插件photo-sphere-viewer
    vue报错解决----npm ERR!
  • 原文地址:https://www.cnblogs.com/hxlasky/p/14178172.html
Copyright © 2020-2023  润新知