Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2312253
  • 博文数量: 473
  • 博客积分: 12252
  • 博客等级: 上将
  • 技术积分: 4307
  • 用 户 组: 普通用户
  • 注册时间: 2007-10-12 10:02
文章分类

全部博文(473)

文章存档

2012年(8)

2011年(63)

2010年(73)

2009年(231)

2008年(98)

分类: Mysql/postgreSQL

2011-06-07 14:57:39

可以通过以下方法获得MySQL状态

[chaos@localhost ~]$ mysqladmin -uroot -p -h127.0.0.1 extended-status root@127.0.0.1:(none) >show status;

得到的结果如下

[chaos@localhost ~]$ mysqladmin -uroot -p -h127.0.0.1 extended-status
Enter password:
+-----------------------------------+--------------+
| Variable_name | Value |
+-----------------------------------+--------------+
| Aborted_clients | 752 |由于客户没有正确关闭连接已经死掉,已经放弃的连接数量
| Aborted_connects | 1958 |尝试已经失败的MySQL服务器的连接的次数
| Binlog_cache_disk_use | 0 |
| Binlog_cache_use | 2152217 |
| Bytes_received | 4322990243 |
| Bytes_sent | 11635219692 |
| Com_admin_commands | 0 |
| Com_assign_to_keycache | 0 |
| Com_alter_db | 0 |
| Com_alter_db_upgrade | 0 |
| Com_alter_event | 0 |
| Com_alter_function | 0 |
| Com_alter_procedure | 0 |
| Com_alter_server | 0 |
| Com_alter_table | 3 |
| Com_alter_tablespace | 0 |
| Com_analyze | 0 |
| Com_backup_table | 0 |
| Com_begin | 24 |
| Com_binlog | 0 |
| Com_call_procedure | 25 |
| Com_change_db | 15 |
| Com_change_master | 0 |
| Com_check | 0 |
| Com_checksum | 0 |
| Com_commit | 18 |
| Com_create_db | 0 |
| Com_create_event | 0 |
| Com_create_function | 0 |
| Com_create_index | 0 |
| Com_create_procedure | 1 |
| Com_create_server | 0 |
| Com_create_table | 2 |
| Com_create_trigger | 0 |
| Com_create_udf | 0 |
| Com_create_user | 0 |
| Com_create_view | 0 |
| Com_dealloc_sql | 18 |
| Com_delete | 1656571 |
| Com_delete_multi | 0 |
| Com_do | 0 |
| Com_drop_db | 0 |
| Com_drop_event | 0 |
| Com_drop_function | 0 |
| Com_drop_index | 0 |
| Com_drop_procedure | 0 |
| Com_drop_server | 0 |
| Com_drop_table | 1 |
| Com_drop_trigger | 0 |
| Com_drop_user | 0 |
| Com_drop_view | 0 |
| Com_empty_query | 0 |
| Com_execute_sql | 1824120 |
| Com_flush | 3 |
| Com_grant | 0 |
| Com_ha_close | 0 |
| Com_ha_open | 0 |
| Com_ha_read | 0 |
| Com_help | 0 |
| Com_insert | 8946446 |
| Com_insert_select | 0 |
| Com_install_plugin | 0 |
| Com_kill | 10 |
| Com_load | 5 |
| Com_load_master_data | 0 |
| Com_load_master_table | 0 |
| Com_lock_tables | 23605 |
| Com_optimize | 0 |
| Com_preload_keys | 0 |
| Com_prepare_sql | 24 |
| Com_purge | 0 |
| Com_purge_before_date | 0 |
| Com_release_savepoint | 0 |
| Com_rename_table | 1 |
| Com_rename_user | 0 |
| Com_repair | 0 |
| Com_replace | 0 |
| Com_replace_select | 0 |
| Com_reset | 0 |
| Com_restore_table | 0 |
| Com_revoke | 0 |
| Com_revoke_all | 0 |
| Com_rollback | 0 |
| Com_rollback_to_savepoint | 0 |
| Com_savepoint | 0 |
| Com_select | 3581274 |
| Com_set_option | 42 |
| Com_show_authors | 0 |
| Com_show_binlog_events | 0 |
| Com_show_binlogs | 0 |
| Com_show_charsets | 0 |
| Com_show_collations | 0 |
| Com_show_column_types | 0 |
| Com_show_contributors | 0 |
| Com_show_create_db | 0 |
| Com_show_create_event | 0 |
| Com_show_create_func | 0 |
| Com_show_create_proc | 0 |
| Com_show_create_table | 8 |
| Com_show_create_trigger | 0 |
| Com_show_databases | 2 |
| Com_show_engine_logs | 0 |
| Com_show_engine_mutex | 0 |
| Com_show_engine_status | 0 |
| Com_show_events | 0 |
| Com_show_errors | 0 |
| Com_show_fields | 3 |
| Com_show_function_status | 0 |
| Com_show_grants | 0 |
| Com_show_keys | 0 |
| Com_show_master_status | 0 |
| Com_show_new_master | 0 |
| Com_show_open_tables | 0 |
| Com_show_plugins | 0 |
| Com_show_privileges | 0 |
| Com_show_procedure_status | 0 |
| Com_show_processlist | 132 |
| Com_show_profile | 0 |
| Com_show_profiles | 0 |
| Com_show_slave_hosts | 0 |
| Com_show_slave_status | 0 |
| Com_show_status | 98 |
| Com_show_storage_engines | 1 |
| Com_show_table_status | 89 |
| Com_show_tables | 3 |
| Com_show_triggers | 0 |
| Com_show_variables | 33 |
| Com_show_warnings | 40 |
| Com_slave_start | 0 |
| Com_slave_stop | 0 |
| Com_stmt_close | 71602 |
| Com_stmt_execute | 22567933 |
| Com_stmt_fetch | 0 |
| Com_stmt_prepare | 72354 |
| Com_stmt_reprepare | 0 |
| Com_stmt_reset | 0 |
| Com_stmt_send_long_data | 0 |
| Com_truncate | 42 |
| Com_uninstall_plugin | 0 |
| Com_unlock_tables | 23605 |
| Com_update | 9418744 |
| Com_update_multi | 0 |
| Com_xa_commit | 0 |
| Com_xa_end | 0 |
| Com_xa_prepare | 0 |
| Com_xa_recover | 0 |
| Com_xa_rollback | 0 |
| Com_xa_start | 0 |
| Compression | OFF |
| Connections | 67416 |试图连接MySQL服务器的次数
| Created_tmp_disk_tables | 3 |
| Created_tmp_files | 0 |
| Created_tmp_tables | 32973 |当执行语句时,已经被创造了的隐含临时表的数量
| Delayed_errors | 0 |用INSERT DELAYED写入的发生某些错误(可能重复键值)的行数
| Delayed_insert_threads | 0 |当执行语句时,已经被创造了的隐含临时表的数量
| Delayed_writes | 0 |用INSERT DELAYED写入的行数
| Flush_commands | 1 |执行FLUSH命令的次数
| Handler_commit | 2809337 |
| Handler_delete | 115126 |请求从一张表中删除行的次数
| Handler_discover | 0 |
| Handler_prepare | 656212 |
| Handler_read_first | 173411 |请求读入表中第一行的次数
| Handler_read_key | 15140379 |请求数字基于键读行
| Handler_read_next | 1657539587 |请求读入基于一个键的一行的次数
| Handler_read_prev | 0 |
| Handler_read_rnd | 486844 |请求读入基于一个固定位置的一行的次数
| Handler_read_rnd_next | 115322174 |
| Handler_rollback | 4 |
| Handler_savepoint | 0 |
| Handler_savepoint_rollback | 0 |
| Handler_update | 392005 |请求更新表中一行的次数
| Handler_write | 108158178 |请求向表中插入一行的次数
| Innodb_buffer_pool_pages_data | 188191 |
| Innodb_buffer_pool_pages_dirty | 0 |
| Innodb_buffer_pool_pages_flushed | 1934152 |
| Innodb_buffer_pool_pages_free | 73952 |
| Innodb_buffer_pool_pages_misc | 1 |
| Innodb_buffer_pool_pages_total | 262144 |
| Innodb_buffer_pool_read_ahead_rnd | 22 |
| Innodb_buffer_pool_read_ahead_seq | 102673 |
| Innodb_buffer_pool_read_requests | 464781993 |
| Innodb_buffer_pool_reads | 1053 |
| Innodb_buffer_pool_wait_free | 0 |
| Innodb_buffer_pool_write_requests | 127534162 |
| Innodb_data_fsyncs | 51919 |
| Innodb_data_pending_fsyncs | 0 |
| Innodb_data_pending_reads | 0 |
| Innodb_data_pending_writes | 0 |
| Innodb_data_read | 107691331584 |
| Innodb_data_reads | 103862 |
| Innodb_data_writes | 176101 |
| Innodb_data_written | 93379299840 |
| Innodb_dblwr_pages_written | 1934152 |
| Innodb_dblwr_writes | 16162 |
| Innodb_log_waits | 43 |
| Innodb_log_write_requests | 132610498 |
| Innodb_log_writes | 38662 |
| Innodb_os_log_fsyncs | 12234 |
| Innodb_os_log_pending_fsyncs | 0 |
| Innodb_os_log_pending_writes | 0 |
| Innodb_os_log_written | 29999831552 |
| Innodb_page_size | 16384 |
| Innodb_pages_created | 1781370 |
| Innodb_pages_read | 6572824 |
| Innodb_pages_written | 1934152 |
| Innodb_row_lock_current_waits | 0 |
| Innodb_row_lock_time | 260786 |
| Innodb_row_lock_time_avg | 119 |
| Innodb_row_lock_time_max | 2045 |
| Innodb_row_lock_waits | 2185 |
| Innodb_rows_deleted | 0 |
| Innodb_rows_inserted | 51498308 |
| Innodb_rows_read | 1747731519 |
| Innodb_rows_updated | 328099 |
| Key_blocks_not_flushed | 0 |
| Key_blocks_unused | 3410899 |
| Key_blocks_used | 23429 |用于关键字缓存的块的数量
| Key_read_requests | 109697014 |请求从缓存读入一个键值的次数
| Key_reads | 4472 |从磁盘物理读入一个键值的次数
| Key_write_requests | 17502816 |请求将一个关键字块写入缓存次数
| Key_writes | 2110005 |将一个键值块物理写入磁盘的次数
| Last_query_cost | 0.000000 |
| Max_used_connections | 501 | 同时使用的连接的最大数目
| Not_flushed_delayed_rows | 0 |在INSERT DELAY队列中等待写入的行的数量
| Open_files | 522 |
| Open_streams | 0 |打开流的数量(主要用于日志记载)
| Open_table_definitions | 19 |
| Open_tables | 512 |打开表的数量
| Opened_files | 4241 |打开文件的数量
| Opened_table_definitions | 116 |
| Opened_tables | 4221 |已经打开的表的数量
| Prepared_stmt_count | 0 |
| Qcache_free_blocks | 1 |
| Qcache_free_memory | 67091136 |
| Qcache_hits | 33866899 |
| Qcache_inserts | 2831470 |
| Qcache_lowmem_prunes | 2648979 |
| Qcache_not_cached | 419021 |
| Qcache_queries_in_cache | 0 |
| Qcache_total_blocks | 1 |
| Queries | 61374746 |
| Questions | 55758308 |发往服务器的查询的数量
| Rpl_status | NULL |
| Select_full_join | 0 |
| Select_full_range_join | 0 |
| Select_range | 130923 |
| Select_range_check | 0 |
| Select_scan | 409 |
| Slave_open_temp_tables | 0 |
| Slave_retried_transactions | 0 |
| Slave_running | OFF |
| Slow_launch_threads | 0 |
| Slow_queries | 145569 |要花超过long_query_time时间的查询数量
| Sort_merge_passes | 0 |
| Sort_range | 32736 |
| Sort_rows | 1744062 |
| Sort_scan | 32741 |
| Table_locks_immediate | 5365894 |
| Table_locks_waited | 17812004 |
| Tc_log_max_pages_used | 0 |
| Tc_log_page_size | 0 |
| Tc_log_page_waits | 0 |
| Threads_cached | 63 |
| Threads_connected | 1 |当前打开的连接的数量
| Threads_created | 45586 |
| Threads_running | 1 |不在睡眠的线程数量
| Uptime | 3036523 |服务器工作了多少秒
| Uptime_since_flush_status | 277009 |
+-----------------------------------+--------------+

通过mysqladmin方式获取的可以通过参数(-i执行一次后睡眠,N秒后再次执行)长时间监控某一参数的变化

[chaos@localhost ~]$ mysqladmin -uroot -p -h127.0.0.1 -i 10 extended-status |grep Com_insert
Enter password:
| Com_insert | 8803779 |
| Com_insert_select | 0 |
| Com_insert | 8866187 |
| Com_insert_select | 0 |
| Com_insert | 8906316 |
| Com_insert_select | 0 |
| Com_insert | 8935765 |
| Com_insert_select | 0 |
| Com_insert | 8946446 |
| Com_insert_select | 0 |
原文请看:%E7%8A%B6%E6%80%81%E6%9F%A5%E7%9C%8B.html
阅读(1004) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~