针对前几天开数据大会当中,有相关图片的监控数据个人感觉比较好,在虚拟机上进行尝试测试,原来此脚本很早网上就有提出,现在记下,以备以后有机会使用;
http://code.taobao.org/svn//orzdba/trunk/orzdba
以下是在进行系统监控的测试;
[root@Slave02 shell]# perl orzdba -mysql -innodb_rows .=================================================. | Welcome to use the orzdba tool ! | | Yep...Chinese English~ | '=============== Date : 2013-04-26 ===============' HOST: Slave02 IP: 180.168.41.175 DB : book|inno|performance_schema|prod Var : binlog_format[MIXED] max_binlog_cache_size[17179869184G] max_binlog_size[1G] max_connect_errors[10] max_connections[151] max_user_connections[0] open_files_limit[1024] sync_binlog[0] table_definition_cache[400] table_open_cache[64] thread_cache_size[0] innodb_adaptive_flushing[ON] innodb_adaptive_hash_index[ON] innodb_buffer_pool_size[128M] innodb_file_per_table[ON] innodb_flush_log_at_trx_commit[1] innodb_flush_method[] innodb_io_capacity[200] innodb_lock_wait_timeout[50] innodb_log_buffer_size[8M] innodb_log_file_size[5M] innodb_log_files_in_group[2] innodb_max_dirty_pages_pct[75] innodb_open_files[300] innodb_read_io_threads[4] innodb_thread_concurrency[0] innodb_write_io_threads[4] -------- -QPS- -TPS- -Hit%- ---innodb rows status--- ------threads------ -----bytes---- time | ins upd del sel iud| lor hit| ins upd del read| run con cre cac| recv send| 11:30:33| 0 0 0 0 0| 0 100.00| 0 0 0 0| 0 0 0 0| 0 0| 11:30:34| 0 0 0 1 0| 0 100.00| 0 0 0 0| 1 1 1 0| 738 1k| 11:30:35| 0 0 0 1 0| 0 100.00| 0 0 0 0| 1 1 1 0| 738 1k| 11:30:36| 0 0 0 1 0| 0 100.00| 0 0 0 0| 1 1 1 0| 738 1k| 11:30:37| 0 0 0 1 0| 0 100.00| 0 0 0 0| 1 1 1 0| 738 1k| 11:30:38| 0 0 0 1 0| 0 100.00| 0 0 0 0| 1 1 1 0| 738 1k| 11:30:39| 0 0 0 1 0| 0 100.00| 0 0 0 0| 1 1 1 0| 738 1k| 11:30:40| 0 0 0 1 0| 0 100.00| 0 0 0 0| 1 1 1 0| 738 1k| 11:30:41| 0 0 0 1 0| 0 100.00| 0 0 0 0| 1 1 1 0| 738 1k| 11:30:42| 0 0 0 1 0| 0 100.00| 0 0 0 0| 1 1 1 0| 738 1k| 11:30:43| 0 0 0 1 0| 0 100.00| 0 0 0 0| 1 1 1 0| 738 1k| 11:30:45| 0 0 0 1 0| 0 100.00| 0 0 0 0| 1 1 1 0| 738 1k| 11:30:46| 0 0 0 1 0| 0 100.00| 0 0 0 0| 1 1 1 0| 738 1k| 11:30:47| 0 0 0 1 0| 0 100.00| 0 0 0 0| 1 1 1 0| 738 1k| 11:30:48| 0 0 0 1 0| 0 100.00| 0 0 0 0| 1 1 1 0| 738 1k| -------- -QPS- -TPS- -Hit%- ---innodb rows status--- ------threads------ -----bytes---- time | ins upd del sel iud| lor hit| ins upd del read| run con cre cac| recv send| 11:30:49| 0 0 0 1 0| 0 100.00| 0 0 0 0| 1 1 1 0| 738 1k| 11:30:50| 0 0 0 1 0| 0 100.00| 0 0 0 0| 1 1 1 0| 738 1k| 11:30:51| 0 0 0 1 0| 0 100.00| 0 0 0 0| 1 1 1 0| 738 1k| 11:30:52| 0 0 0 1 0| 0 100.00| 0 0 0 0| 1 1 1 0| 738 1k| 11:30:53| 0 0 0 1 0| 0 100.00| 0 0 0 0| 1 1 1 0| 738 1k| 11:30:54| 0 0 0 1 0| 0 100.00| 0 0 0 0| 1 1 1 0| 738 1k| 11:30:55| 0 0 0 1 0| 0 100.00| 0 0 0 0| 1 1 1 0| 738 1k| 11:30:56| 0 0 0 1 0| 0 100.00| 0 0 0 0| 1 1 1 0| 738 1k| 11:30:57| 0 0 0 1 0| 0 100.00| 0 0 0 0| 1 1 1 0| 738 1k| 11:30:58| 0 0 0 1 0| 0 100.00| 0 0 0 0| 1 1 1 0| 738 1k| 11:30:59| 0 0 0 1 0| 0 100.00| 0 0 0 0| 1 1 1 0| 738 1k| 11:31:00| 0 0 0 1 0| 0 100.00| 0 0 0 0| 1 1 1 0| 738 1k| 11:31:01| 0 0 0 1 0| 0 100.00| 0 0 0 0| 1 1 1 0| 738 1k| 11:31:02| 0 0 0 1 0| 0 100.00| 0 0 0 0| 1 1 1 0| 738 1k| 11:31:03| 0 0 0 1 0| 0 100.00| 0 0 0 0| 1 1 1 0| 738 1k| -------- -QPS- -TPS- -Hit%- ---innodb rows status--- ------threads------ -----bytes---- time | ins upd del sel iud| lor hit| ins upd del read| run con cre cac| recv send| 11:31:04| 0 0 0 1 0| 0 100.00| 0 0 0 0| 1 1 1 0| 738 1k|
[root@Slave02 shell]# perl orzdba -innodb .=================================================. | Welcome to use the orzdba tool ! | | Yep...Chinese English~ | '=============== Date : 2013-04-26 ===============' HOST: Slave02 IP: 180.168.41.175 DB : book|inno|performance_schema|prod Var : binlog_format[MIXED] max_binlog_cache_size[17179869184G] max_binlog_size[1G] max_connect_errors[10] max_connections[151] max_user_connections[0] open_files_limit[1024] sync_binlog[0] table_definition_cache[400] table_open_cache[64] thread_cache_size[0] innodb_adaptive_flushing[ON] innodb_adaptive_hash_index[ON] innodb_buffer_pool_size[128M] innodb_file_per_table[ON] innodb_flush_log_at_trx_commit[1] innodb_flush_method[] innodb_io_capacity[200] innodb_lock_wait_timeout[50] innodb_log_buffer_size[8M] innodb_log_file_size[5M] innodb_log_files_in_group[2] innodb_max_dirty_pages_pct[75] innodb_open_files[300] innodb_read_io_threads[4] innodb_thread_concurrency[0] innodb_write_io_threads[4] -------- ---innodb bp pages status-- -----innodb data status---- --innodb log-- his --log(byte)-- read ---query--- time | data free dirty flush| reads writes read written|fsyncs written| list uflush uckpt view inside que| 11:36:07| 0 0 0 0| 0 0 0 0| 0 0| 0 0 0 0 0 0| 11:36:08| 214 7977 0 0| 0 0 0 0| 0 0| 43 0 0 1 0 0| 11:36:09| 214 7977 0 0| 0 0 0 0| 0 0| 43 0 0 1 0 0| 11:36:10| 214 7977 0 0| 0 0 0 0| 0 0| 43 0 0 1 0 0| 11:36:11| 214 7977 0 0| 0 0 0 0| 0 0| 43 0 0 1 0 0| 11:36:12| 214 7977 0 0| 0 0 0 0| 0 0| 43 0 0 1 0 0| 11:36:13| 214 7977 0 0| 0 0 0 0| 0 0| 43 0 0 1 0 0| 11:36:14| 214 7977 0 0| 0 0 0 0| 0 0| 43 0 0 1 0 0| 11:36:15| 214 7977 0 0| 0 0 0 0| 0 0| 43 0 0 1 0 0| 11:36:16| 214 7977 0 0| 0 0 0 0| 0 0| 43 0 0 1 0 0| 11:36:17| 214 7977 0 0| 0 0 0 0| 0 0| 43 0 0 1 0 0| 11:36:18| 214 7977 0 0| 0 0 0 0| 0 0| 43 0 0 1 0 0| 11:36:19| 214 7977 0 0| 0 0 0 0| 0 0| 43 0 0 1 0 0| 11:36:20| 214 7977 0 0| 0 0 0 0| 0 0| 43 0 0 1 0 0| 11:36:21| 214 7977 0 0| 0 0 0 0| 0 0| 43 0 0 1 0 0| -------- ---innodb bp pages status-- -----innodb data status---- --innodb log-- his --log(byte)-- read ---query--- time | data free dirty flush| reads writes read written|fsyncs written| list uflush uckpt view inside que| 11:36:22| 214 7977 0 0| 0 0 0 0| 0 0| 43 0 0 1 0 0| 11:36:23| 214 7977 0 0| 0 0 0 0| 0 0| 43 0 0 1 0 0| 11:36:24| 214 7977 0 0| 0 0 0 0| 0 0| 43 0 0 1 0 0| 11:36:25| 214 7977 0 0| 0 0 0 0| 0 0| 43 0 0 1 0 0| 11:36:26| 214 7977 0 0| 0 0 0 0| 0 0| 43 0 0 1 0 0| 11:36:27| 214 7977 0 0| 0 0 0 0| 0 0| 43 0 0 1 0 0| 11:36:28| 214 7977 0 0| 0 0 0 0| 0 0| 43 0 0 1 0 0| 11:36:29| 214 7977 0 0| 0 0 0 0| 0 0| 43 0 0 1 0 0| 11:36:30| 214 7977 0 0| 0 0 0 0| 0 0| 43 0 0 1 0 0| 11:36:31| 214 7977 0 0| 0 0 0 0| 0 0| 43 0 0 1 0 0|
[root@Slave02 shell]# mysql -uroot -proot -e "show engine innodb status\G" | gre p -E -A4 -B1 --color 'TRANSACTIONS|LOG|ROW OPERATIONS' ------------ TRANSACTIONS ------------ Trx id counter 2100 Purge done for trx's n:o < 1304 undo n:o < 0 History list length 43 LIST OF TRANSACTIONS FOR EACH SESSION: ---TRANSACTION 0, not started MySQL thread id 1, query id 2 localhost root show engine innodb status -------- -- --- LOG --- Log sequence number 893334359 Log flushed up to 893334359 Last checkpoint at 893334359 -- -------------- ROW OPERATIONS -------------- 0 queries inside InnoDB, 0 queries in queue 1 read views open inside InnoDB Main thread process no. 3313, id 2768165776, state: waiting for server activity [root@Slave02 shell]# [root@Slave02 shell]# mysql -uroot -proot -e "show engine innodb status\G" | grep -E -A4 -B1 --color 'TRANSACTIONS|LOG|ROW OPERATIONS' ------------ TRANSACTIONS ------------ Trx id counter 2100 Purge done for trx's n:o < 1304 undo n:o < 0 History list length 43 LIST OF TRANSACTIONS FOR EACH SESSION: ---TRANSACTION 0, not started MySQL thread id 2, query id 5 localhost root show engine innodb status -------- -- --- LOG --- Log sequence number 893334359 Log flushed up to 893334359 Last checkpoint at 893334359 -- -------------- ROW OPERATIONS -------------- 0 queries inside InnoDB, 0 queries in queue 1 read views open inside InnoDB Main thread process no. 3313, id 2768165776, state: waiting for server activity [root@Slave02 shell]#
这里需要安装一个相关的perl包;
[root@Slave02 shell]# perl orzdba -lazy -rt
.=================================================.
| Welcome to use the orzdba tool ! |
| Yep...Chinese English~ |
'=============== Date : 2013-04-26 ==============='
HOST: Slave02 IP: 180.168.41.175
DB : book|inno|performance_schema|prod
Var : binlog_format[MIXED] max_binlog_cache_size[17179869184G] max_binlog_size[1G]
max_connect_errors[10] max_connections[151] max_user_connections[0]
open_files_limit[1024] sync_binlog[0] table_definition_cache[400]
table_open_cache[64] thread_cache_size[0]
innodb_adaptive_flushing[ON] innodb_adaptive_hash_index[ON] innodb_buffer_pool_size[128M]
innodb_file_per_table[ON] innodb_flush_log_at_trx_commit[1] innodb_flush_method[]
innodb_io_capacity[200] innodb_lock_wait_timeout[50] innodb_log_buffer_size[8M]
innodb_log_file_size[5M] innodb_log_files_in_group[2] innodb_max_dirty_pages_pct[75]
innodb_open_files[300] innodb_read_io_threads[4] innodb_thread_concurrency[0]
innodb_write_io_threads[4]
-------- -----load-avg---- ---cpu-usage--- ---swap--- -QPS- -TPS- -Hit%- --------tcprstat(us)--------
time | 1m 5m 15m |usr sys idl iow| si so| ins upd del sel iud| lor hit| count avg 95-avg 99-avg|
11:37:36| 0.00 0.00 0.00| 0 0 99 1| 0 0| 0 0 0 0 0| 0 100.00|
[ERROR] need File::Lockfile !
如上缺少相关的File::Lockfile包,需要手工编译即可;
以下为编译过程过程;
[root@Slave02 ~]# perl Makefile.PL --mysql_config=/usr/local/mysql/bin/mysql_config Can't open perl script "Makefile.PL": No such file or directory [root@Slave02 ~]# perl -MCPAN -e shell cpan shell -- CPAN exploration and modules installation (v1.9800) Enter 'h' for help. cpan[1]> install File::Lockfile Reading '/root/.cpan/Metadata' Database was generated on Sun, 07 Apr 2013 20:41:02 GMT Fetching with LWP: http://mirrors.sohu.com/CPAN/authors/01mailrc.txt.gz Reading '/root/.cpan/sources/authors/01mailrc.txt.gz' ............................................................................DONE Fetching with LWP: http://mirrors.sohu.com/CPAN/modules/02packages.details.txt.gz Reading '/root/.cpan/sources/modules/02packages.details.txt.gz' Database was generated on Thu, 25 Apr 2013 19:53:02 GMT .............. New CPAN.pm version (v2.00) available. [Currently running version is v1.9800] You might want to try install CPAN reload cpan to both upgrade CPAN.pm and run the new version without leaving the current session. ..............................................................DONE Fetching with LWP: http://mirrors.sohu.com/CPAN/modules/03modlist.data.gz Reading '/root/.cpan/sources/modules/03modlist.data.gz' ............................................................................DONE Writing /root/.cpan/Metadata Running install for module 'File::Lockfile' Running make for G/GL/GLORYBOX/File-Lockfile-v1.0.5.tar.gz cpan[1]> install File::LockfileFetching with LWP: http://mirrors.sohu.com/CPAN/authors/id/G/GL/GLORYBOX/File-Lockfile-v1.0.5.tar.gz Fetching with LWP: http://mirrors.sohu.com/CPAN/authors/id/G/GL/GLORYBOX/CHECKSUMS Checksum for /root/.cpan/sources/authors/id/G/GL/GLORYBOX/File-Lockfile-v1.0.5.tar.gz ok Scanning cache /root/.cpan/build for sizes ...............................................................-------------DONE DEL(1/3): /root/.cpan/build/DBD-mysql-4.022 DEL(2/3): /root/.cpan/build/DBD-mysql-4.022-TKS17z DEL(3/3): /root/.cpan/build/DBD-mysql-4.022-TKS17z.yml /bin/tar: Read 3584 bytes from - CPAN.pm: Building G/GL/GLORYBOX/File-Lockfile-v1.0.5.tar.gz Checking prerequisites... requires: ! Class::Data::Inheritable is not installed ERRORS/WARNINGS FOUND IN PREREQUISITES. You may wish to install the versions of the modules indicated above before proceeding with this installation Created MYMETA.yml and MYMETA.json Creating new 'Build' script for 'File-Lockfile' version 'v1.0.5' ---- Unsatisfied dependencies detected during ---- ---- GLORYBOX/File-Lockfile-v1.0.5.tar.gz ---- Class::Data::Inheritable [requires] Shall I follow them and prepend them to the queue of modules we are processing right now? [yes] yes Running Build test Delayed until after prerequisites Running Build install Delayed until after prerequisites Running install for module 'Class::Data::Inheritable' Running make for T/TM/TMTM/Class-Data-Inheritable-0.08.tar.gz Fetching with LWP: http://mirrors.sohu.com/CPAN/authors/id/T/TM/TMTM/Class-Data-Inheritable-0.08.tar.gz Fetching with LWP: http://mirrors.sohu.com/CPAN/authors/id/T/TM/TMTM/CHECKSUMS Checksum for /root/.cpan/sources/authors/id/T/TM/TMTM/Class-Data-Inheritable-0.08.tar.gz ok CPAN.pm: Building T/TM/TMTM/Class-Data-Inheritable-0.08.tar.gz Checking if your kit is complete... Looks good Writing Makefile for Class::Data::Inheritable Writing MYMETA.yml and MYMETA.json cp lib/Class/Data/Inheritable.pm blib/lib/Class/Data/Inheritable.pm Manifying blib/man3/Class::Data::Inheritable.3pm TMTM/Class-Data-Inheritable-0.08.tar.gz /usr/bin/make -- OK Running make test PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t t/Inheritable.t ... ok t/pod-coverage.t .. skipped: Test::Pod::Coverage 1.00 required for testing POD coverage t/pod.t ........... skipped: Test::Pod 1.00 required for testing POD All tests successful. Files=3, Tests=15, 0 wallclock secs ( 0.04 usr 0.02 sys + 0.06 cusr 0.01 csys = 0.13 CPU) Result: PASS TMTM/Class-Data-Inheritable-0.08.tar.gz /usr/bin/make test -- OK Running make install Installing /usr/lib/perl5/site_perl/5.8.8/Class/Data/Inheritable.pm Installing /usr/share/man/man3/Class::Data::Inheritable.3pm Appending installation info to /usr/lib/perl5/5.8.8/i386-linux-thread-multi/perllocal.pod TMTM/Class-Data-Inheritable-0.08.tar.gz /usr/bin/make install -- OK Running Build for G/GL/GLORYBOX/File-Lockfile-v1.0.5.tar.gz Has already been unwrapped into directory /root/.cpan/build/File-Lockfile-v1.0.5-OKUNdH CPAN.pm: Building G/GL/GLORYBOX/File-Lockfile-v1.0.5.tar.gz Building File-Lockfile GLORYBOX/File-Lockfile-v1.0.5.tar.gz ./Build -- OK Running Build test Use of uninitialized value in length at /usr/lib/perl5/site_perl/5.8.8/Module/Build/Base.pm line 2767. t/01_basic.t .. ok All tests successful. Files=1, Tests=5, 0 wallclock secs ( 0.02 usr 0.00 sys + 0.03 cusr 0.03 csys = 0.08 CPU) Result: PASS GLORYBOX/File-Lockfile-v1.0.5.tar.gz ./Build test -- OK Running Build install Building File-Lockfile Installing /usr/lib/perl5/site_perl/5.8.8/File/Lockfile.pm Installing /usr/lib/perl5/site_perl/5.8.8/File/Lockfile.pod Installing /usr/share/man/man3/File::Lockfile.3pm GLORYBOX/File-Lockfile-v1.0.5.tar.gz ./Build install -- OK cpan[2]>然后在进行查看mysql响应时间;
[root@Slave02 shell]# perl orzdba -lazy -rt .=================================================. | Welcome to use the orzdba tool ! | | Yep...Chinese English~ | '=============== Date : 2013-04-26 ===============' HOST: Slave02 IP: 180.168.41.175 DB : book|inno|performance_schema|prod Var : binlog_format[MIXED] max_binlog_cache_size[17179869184G] max_binlog_size[1G] max_connect_errors[10] max_connections[151] max_user_connections[0] open_files_limit[1024] sync_binlog[0] table_definition_cache[400] table_open_cache[64] thread_cache_size[0] innodb_adaptive_flushing[ON] innodb_adaptive_hash_index[ON] innodb_buffer_pool_size[128M] innodb_file_per_table[ON] innodb_flush_log_at_trx_commit[1] innodb_flush_method[] innodb_io_capacity[200] innodb_lock_wait_timeout[50] innodb_log_buffer_size[8M] innodb_log_file_size[5M] innodb_log_files_in_group[2] innodb_max_dirty_pages_pct[75] innodb_open_files[300] innodb_read_io_threads[4] innodb_thread_concurrency[0] innodb_write_io_threads[4] -------- -----load-avg---- ---cpu-usage--- ---swap--- -QPS- -TPS- -Hit%- --------tcprstat(us)-------- time | 1m 5m 15m |usr sys idl iow| si so| ins upd del sel iud| lor hit| count avg 95-avg 99-avg| 11:40:40| 0.61 0.18 0.06| 1 0 98 1| 0 0| 0 0 0 0 0| 0 100.00|sh: /usr/bin/tcprstat: No such file or directory 0 0 0 0| 11:40:41| 0.61 0.18 0.06| 1 2 95 2| 0 0| 0 0 0 1 0| 0 100.00| 0 0 0 0| 11:40:42| 0.61 0.18 0.06| 1 1 98 0| 0 0| 0 0 0 1 0| 0 100.00| 0 0 0 0| 11:40:43| 0.61 0.18 0.06| 1 1 98 0| 0 0| 0 0 0 1 0| 0 100.00| 0 0 0 0| 11:40:44| 0.61 0.18 0.06| 1 2 97 0| 0 0| 0 0 0 1 0| 0 100.00| 0 0 0 0| 11:40:45| 0.56 0.17 0.06| 1 2 96 1| 0 0| 0 0 0 1 0| 0 100.00| 0 0 0 0| 11:40:46| 0.56 0.17 0.06| 1 1 98 0| 0 0| 0 0 0 1 0| 0 100.00| 0 0 0 0| 11:40:47| 0.56 0.17 0.06| 2 2 96 0| 0 0| 0 0 0 1 0| 0 100.00| 0 0 0 0| 11:40:48| 0.56 0.17 0.06| 1 2 97 0| 0 0| 0 0 0 1 0| 0 100.00| 0 0 0 0| 11:40:49| 0.56 0.17 0.06| 1 1 98 0| 0 0| 0 0 0 1 0| 0 100.00| 0 0 0 0| 11:40:50| 0.51 0.17 0.06| 1 2 97 0| 0 0| 0 0 0 1 0| 0 100.00| 0 0 0 0| 11:40:51| 0.51 0.17 0.06| 1 2 97 0| 0 0| 0 0 0 1 0| 0 100.00| 0 0 0 0| 11:40:52| 0.51 0.17 0.06| 1 2 97 0| 0 0| 0 0 0 1 0| 0 100.00| 0 0 0 0| 11:40:53| 0.51 0.17 0.06| 1 1 98 0| 0 0| 0 0 0 1 0| 0 100.00| 0 0 0 0| 11:40:54| 0.51 0.17 0.06| 1 2 97 0| 0 0| 0 0 0 1 0| 0 100.00| 0 0 0 0| -------- -----load-avg---- ---cpu-usage--- ---swap--- -QPS- -TPS- -Hit%- --------tcprstat(us)-------- time | 1m 5m 15m |usr sys idl iow| si so| ins upd del sel iud| lor hit| count avg 95-avg 99-avg| 11:40:55| 0.47 0.17 0.06| 1 2 97 0| 0 0| 0 0 0 1 0| 0 100.00| 0 0 0 0| 11:40:56| 0.47 0.17 0.06| 1 2 97 0| 0 0| 0 0 0 1 0| 0 100.00| 0 0 0 0| 11:40:57| 0.47 0.17 0.06| 2 2 96 0| 0 0| 0 0 0 1 0| 0 100.00| 0 0 0 0|