Thursday 28 August 2014

my_print_defaults: command not found


[root@centos7 mysql]# service mysql status

/etc/init.d/mysql: line 256: my_print_defaults: command not found

 ERROR! MySQL is not running

[root@centos7 mysql]# find / -name my_print_defaults

/home/mysql/bin/my_print_defaults

[root@centos7 mysql]# cp /home/mysql/bin/my_print_defaults /usr/bin

[root@centos7 mysql]# service mysql status

 ERROR! MySQL is not running

[root@centos7 mysql]# service mysql restart

 ERROR! MySQL server PID file could not be found!

/etc/init.d/mysql: line 276: cd: /usr/local/mysql: No such file or directory

Starting MySQL ERROR! Couldn't find MySQL server (/usr/local/mysql/bin/mysqld_safe)

[root@centos7 mysql]# vi /etc/init.d/mysql

Replace those /usr/local/mysql to /home/mysql(/home/mysql is my mysql default path)

[root@centos7 mysql]# service mysql stop

Shutting down MySQL..140827 16:25:40 mysqld_safe mysqld from pid file /home/mysql/data/centos7.pid ended

 SUCCESS!

[1]+  Done                    bin/mysqld_safe --user=mysql

[root@centos7 mysql]# service mysql start

Starting MySQL.. SUCCESS!

[root@centos7 mysql]#

Sysbench 0.5 on CENTOS7



[root@centos7 home]# ls -lah
-rw-r--r--.  1 root  root  180K Jan 18  2013 sysbench-0.5-3.el6_.x86_64.rpm
[root@centos7 home]# rpm -ivh sysbench-0.5-3.el6_.x86_64.rpm

Preparing...                          ################################# [100%]

Updating / installing...

   1:sysbench-0.5-3.el6               ################################# [100%]


[root@centos7 home]# sysbench --test=oltp help
sysbench 0.5:  multi-threaded system evaluation benchmark
PANIC: unprotected error in call to Lua API (cannot open oltp: No such file or directory)
[root@centos7 home]# ll /usr/share/doc/sysbench/tests/db
total 44
-rw-r--r--. 1 root root 3585 Sep  7  2012 common.lua
-rw-r--r--. 1 root root  340 Sep  7  2012 delete.lua
-rw-r--r--. 1 root root  830 Sep  7  2012 insert.lua
-rw-r--r--. 1 root root 2925 Sep  7  2012 oltp.lua
-rw-r--r--. 1 root root  342 Sep  7  2012 oltp_simple.lua
-rw-r--r--. 1 root root  425 Sep  7  2012 parallel_prepare.lua
-rw-r--r--. 1 root root  343 Sep  7  2012 select.lua
-rw-r--r--. 1 root root 3964 Sep  7  2012 select_random_points.lua
-rw-r--r--. 1 root root 4066 Sep  7  2012 select_random_ranges.lua
-rw-r--r--. 1 root root  343 Sep  7  2012 update_index.lua
-rw-r--r--. 1 root root  552 Sep  7  2012 update_non_index.lua

[root@centos7 home]#
[root@centos7 db]# sysbench --test='/usr/share/doc/sysbench/tests/db/oltp.lua' --oltp_tables_count=100 --report-interval=10 --oltp-table-size=1000 --num-threads=2 --mysql-user=root --mysql-password=123123  --mysql-table-engine=innodb  --rand-init=on  --mysql-host=192.168.1.144 --mysql-port=3306 --mysql-db=oltp prepare
sysbench 0.5:  multi-threaded system evaluation benchmark
Creating table 'sbtest1'...
Inserting 1000 records into 'sbtest1'
Creating table 'sbtest2'...
…………………………………………………………
Inserting 1000 records into 'sbtest98'
Creating table 'sbtest99'...
Inserting 1000 records into 'sbtest99'
Creating table 'sbtest100'...
Inserting 1000 records into 'sbtest100'
[root@centos7 db]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.6.11 MySQL Community Server (GPL)
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| oltp               |
| performance_schema |
| test               |
+--------------------+
5 rows in set (0.01 sec)
mysql> use oltp;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> show tables;
+----------------+
| Tables_in_oltp |
+----------------+
| sbtest1        |
| sbtest10       |
| sbtest100      |
[root@centos7 db]# sysbench --test='/usr/share/doc/sysbench/tests/db/oltp.lua'  --oltp_tables_count=100 --report-interval=5 --oltp-table-size=100 --mysql-user=root  --mysql-password=123123 --oltp-connect-delay=10  --oltp-dist-type=uniform   --rand-init=on  --mysql-table-engine=innodb --mysql-host=192.168.1.144 --mysql-port=3306 --mysql-db=oltp --max-time=15 --max-requests=0 --num-threads=6 --thread-stack-size=256   run
sysbench 0.5:  multi-threaded system evaluation benchmark
Running the test with following options:
Number of threads: 6
Report intermediate results every 5 second(s)
Initializing random number generator from timer.
Random number generator seed is 0 and will be ignored
Threads started!
[   5s] threads: 6, tps: 53.62, reads/s: 767.42, writes/s: 219.26, response time: 137.18ms (95%)
[  10s] threads: 6, tps: 53.60, reads/s: 750.38, writes/s: 214.40, response time: 160.24ms (95%)
[  15s] threads: 6, tps: 53.80, reads/s: 753.18, writes/s: 215.19, response time: 139.92ms (95%)
OLTP test statistics:
    queries performed:
        read:                            11354
        write:                           3244
        other:                           1622
        total:                           16220
    transactions:                        811    (53.68 per sec.)
    deadlocks:                           0      (0.00 per sec.)
    read/write requests:                 14598  (966.31 per sec.)
    other operations:                    1622   (107.37 per sec.)
 
General statistics:
    total time:                          15.1069s
    total number of events:              811
    total time taken by event execution: 90.3482s
    response time:
         min:                                 49.34ms
         avg:                                111.40ms
         max:                                202.72ms
         approx.  95 percentile:             144.47ms

Threads fairness:
    events (avg/stddev):           135.1667/1.07
execution time (avg/stddev):   15.0580/0.04
 
[root@centos7 db]# sysbench --test='/usr/share/doc/sysbench/tests/db/oltp.lua'  --oltp_tables_count=100 --report-interval=5 --oltp-table-size=100 --mysql-user=root  --mysql-password=123123  --mysql-table-engine=innodb  --mysql-host=192.168.1.144 --mysql-port=3306 --mysql-db=oltp cleanup
sysbench 0.5:  multi-threaded system evaluation benchmark
Dropping table 'sbtest1'...
Dropping table 'sbtest2'...
…………………………………
Dropping table 'sbtest99'...
Dropping table 'sbtest100'...
[root@centos7 db]#
#initinal script
sysbench --test='/usr/share/doc/sysbench/tests/db/oltp.lua' --oltp_tables_count=100 --report-interval=10 --oltp-table-size=1000 --num-threads=2 --mysql-user=root --mysql-password=123123  --mysql-table-engine=innodb  --rand-init=on  --mysql-host=192.168.1.144 --mysql-port=3306 --mysql-db=oltp prepare
#stress test script
sysbench --test='/usr/share/doc/sysbench/tests/db/oltp.lua'  --oltp_tables_count=100 --report-interval=5 --oltp-table-size=100 --mysql-user=root  --mysql-password=123123 --oltp-connect-delay=10  --oltp-dist-type=uniform   --rand-init=on  --mysql-table-engine=innodb --mysql-host=192.168.1.144 --mysql-port=3306 --mysql-db=oltp --max-time=15 --max-requests=0 --num-threads=6 --thread-stack-size=256   run
#clean script
sysbench --test='/usr/share/doc/sysbench/tests/db/oltp.lua'  --oltp_tables_count=100 --report-interval=5 --oltp-table-size=100 --mysql-user=root  --mysql-password=123123  --mysql-table-engine=innodb  --mysql-host=192.168.1.144 --mysql-port=3306 --mysql-db=oltp cleanup