在centos6.x上

yum install sysbench

的时候因为sysbench会依赖于mysql,而不管是系统自带的原生的mysql-server,还是mysql分支percona-server,都会跟我们装的percona-xtradb-cluster冲突,所以,幸好我找了第四台机器来安装sysbench,具体测试步骤如下:

首先,登录percona xtradb cluster的其中一台机器,这里登node1(10.0.0.1),执行mysql登入系统,并创建测试用数据库sbtest并赋予权限给用户sbtest(密码是sbtest)

yum install sysbench

然后,登录第四台机器(ip是10.0.0.4),安装sysbench并跑测试程序。

yum-yinstall sysbench
sysbench --test=oltp --mysql-host=10.0.0.1,10.0.0.2,10.0.0.3 --mysql-user=sbtest --mysql-password=sbtest --db-driver=mysql prepare
sysbench --test=oltp --mysql-host=10.0.0.1,10.0.0.2,10.0.0.3 --mysql-user=sbtest --mysql-password=sbtest --db-driver=mysql run


这是最后输出的结果:

sysbench 0.4.12:  multi-threaded system evaluation benchmark
 
Running the test with following options:
Number of threads: 1
 
Doing OLTP test.
Running mixed OLTP test
Using Special distribution (12 iterations,  1 pct of values are returned in 75 pct cases)
Using "BEGIN" for starting transactions
Using auto_inc on the id column
Maximum number of requests for OLTP test is limited to 10000
Threads started!
 
Done.
 
OLTP test statistics:
    queries performed:
        read:                            140000
        write:                           50000
        other:                           20000
        total:                           210000
    transactions:                        10000  (21.26 per sec.)
    deadlocks:                           0      (0.00 per sec.)
    read/write requests:                 190000 (403.93 per sec.)
    other operations:                    20000  (42.52 per sec.)
 
Test execution summary:
    total time:                          470.3826s
    total number of events:              10000
    total time taken by event execution: 470.2785
    per-request statistics:
         min:                                 27.22ms
         avg:                                 47.03ms
         max:                                458.16ms
         approx.  95 percentile:              99.91ms
 
Threads fairness:
    events (avg/stddev):           10000.0000/0.00
    execution time (avg/stddev):   470.2785/0.00



最后,清除测试数据:

sysbench --test=oltp --mysql-host=10.0.0.1,10.0.0.2,10.0.0.3 --mysql-user=sbtest --mysql-password=sbtest --db-driver=mysql cleanup