mysqladmin extended-status總結

一、mysql

Aborted_clients 因爲客戶沒有正確關閉鏈接已經死掉,已經放棄的鏈接數量。(作監控)sql

    表示客戶端沒有正確的關閉鏈接,而被終止的鏈接數,引發的緣由
    1.客戶端程序退出以前未調用mysql_close()來關閉mysql鏈接
    2.客戶端的休眠時間超過了mysql系統變量wait_timeout和interactive_timeout的值,致使鏈接被mysql進程終止
    3.客戶端程序在數據傳輸過程當中忽然結束

二、數據庫

Aborted_connects 嘗試已經失敗的MySQL服務器的鏈接的次數。(作監控)緩存


    表示嘗試鏈接到mysql服務器的失敗次數,能夠結合host_cache來分析問題,引發的緣由:
    1.密碼錯誤  
    2.沒權限訪問,可是嘗試去訪問
    3.鏈接超時
    4.鏈接信息不正確

若是碰到鏈接超時等信息必定要分析一下是什麼緣由引發的服務器

在MySQL服務器使用tcpdump抓包session

[root@lichao ~]# tcpdump -i eth0  port 3306  -s 1500 -w tcpdump.logtcp

而後在另一臺MySQL服務器,使用不存在的帳號或錯誤的密碼訪問MySQL數據庫ide

# mysql -h xx.xx.xx.xx -u xxx  -pxxxxfetch

ERROR 1045 (28000): Access denied for user 'xxx'@'xx.xx.xx.xxx' (using password: YES)ui

# mysql -h xx.xx.xx.xx -u xxxx -pxxx

ERROR 1045 (28000): Access denied for user 'test'@'xx.xx.xx.xx' (using password: YES)

[root@lichao~]#

 

執行完命令後,你可使用CTRL + C結束抓包分析,而後查看分析。以下截圖所示:

 

[root@lichao ~]# tcpdump -i eth0  port 3306  -s 1500 -w tcpdump.log

tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 1500 bytes

28 packets captured

28 packets received by filter

0 packets dropped by kernel

[root@lichao ~]# strings tcpdump.log

三、

Binlog_cache_disk_use表示由於咱們binlog_cache_size設計的內存不足致使緩存二進制日誌用到了臨時文件的次數(作監控)

四、

Binlog_cache_use  表示 用binlog_cache_size緩存的次數

當對應的Binlog_cache_disk_use 值比較大的時候 咱們能夠考慮適當的調高 binlog_cache_size 對應的值

沒有什麼大事務,dml也不是很頻繁的狀況下能夠設置小一點,若是事務大並且多,dml操做也頻繁,則能夠適當的調大一點。

前者建議是1048576  --1M

後者建議是: 2097152 -- 4194304  即 2--4M

查看方式:show global status like 'bin%';

注意:

(1)max_binlog_cache_size 表示的是binlog 可以使用的最大cache 內存大小

當咱們執行多語句事務的時候 全部session的使用的內存超過max_binlog_cache_size的值時

就會報錯:「Multi-statement transaction required more than 'max_binlog_cache_size' bytes ofstorage」

(2)設置太大的話,會比較消耗內存資源;設置過小又會使用到臨時文件即disk

調整方式(兩種辦法):

(1)配置文件設置my.cnf

binlog_cache_size = 1M

(2)set global binlog_cache_size = 1048576

解釋:

show status like '%binlog%';

stmt就是statement的意思

Binlog_cache_disk_use  (事務類)二進志日誌緩存的已經存在硬盤的條數 

Binlog_cache_use    (事務類)二進制日誌已緩存的條數(內存中)    注意,這個不是容量,而是事務個數。每次有一條事務提交,都會有一次增長

Binlog_stmt_cache_disk_use  (非事務類)二進志日誌緩存的已經存在硬盤的條數  

Binlog_stmt_cache_use  (非事務類)二進制日誌已緩存的條數(內存中) 非事務型的語句,都存在這兒,好比MYISAM引擎的表,插入記錄就存在這兒

參數衍生:

binlog_cache_use和binlog_cache_disk_use二者結合能夠用來調整binlog_cache_size的大小
binglog_stmt_cache_use和binlog_stmt_cache_disk_use二者結合能夠有來調整 binlog_stmt_cache_size的大小

五、

Bytes_received/Bytes_sent(作監控)

看 mysql總的吞吐量

Bytes_received
從全部客戶端接收到的字節數。結合bytes sent, 能夠做爲數據庫網卡吞吐量的評測指標,單位字節

Bytes_sent
發送給全部客戶端的字節數。結合bytes received,能夠做爲數據庫網卡吞吐量的評測指標,單位字節


六、

Com_admin_commands [ Com_xxx ]
Com_xxx 語句計數變量表示每一個xxx 語句執行的次數。每類語句有一個狀態變量。例如,Com_delete和Com_insert分別統計DELETE 和INSERT語句執行的次數。
Com_xxx包括:
Com_alter_db
Com_alter_db_upgrade
Com_alter_event
Com_alter_function
Com_alter_procedure
Com_alter_server
Com_alter_table
Com_alter_tablespace
Com_analyze
Com_assign_to_keycache
Com_begin
Com_binlog
Com_call_procedure
Com_change_db
Com_change_master
Com_check
Com_checksum
Com_commit  MySQL提交的事務數量,能夠用來統計TPS(每秒事務數),計算公式:Com_commit/S+Com_rollback/S(作監控)

Com_create_db
Com_create_event
Com_create_function
Com_create_index
Com_create_procedure-------建立存儲過程個數(監控)
Com_create_server
Com_create_table--------建立數據表個數(監控)
Com_create_trigger
Com_create_udf
Com_create_user
Com_create_view
Com_dealloc_sql
Com_delete
  MySQL刪除的數量,能夠用來統計qps,計算公式:questions / uptime 或者基於com_%計算:Com_select/s + Com_insert/s + Com_update/s + Com_delete/s(作監控)

Com_delete_multi
Com_do
Com_drop_db    (作監控)
Com_drop_event
Com_drop_function
Com_drop_index
Com_drop_procedure
Com_drop_server
Com_drop_table(作監控)
Com_drop_trigger
Com_drop_user
Com_drop_view
Com_empty_query
Com_execute_sql
Com_flush
Com_grant(作監控)
Com_ha_close
Com_ha_open
Com_ha_read
Com_help
Com_insert 
MySQL插入的數量,能夠用來統計qps,qps計算公式:questions / uptime 或者基於com_%計算:Com_select/s + Com_insert/s + Com_update/s + Com_delete/s (作監控)

Com_insert_select
Com_install_plugin
Com_kill
Com_load
Com_lock_tables------鎖表lock tables,解鎖命令unlock tables
Com_optimize
Com_preload_keys
Com_prepare_sql
Com_purge
Com_purge_before_date
Com_release_savepoint
Com_rename_table
Com_rename_user
Com_repair
Com_replace
Com_replace_select
Com_reset
Com_resignal
Com_revoke
Com_revoke_all
Com_rollback  
MySQL回滾的事務數量,能夠用來統計TPS(每秒事務數),計算公式:Com_commit/S+Com_rollback/S (監控)

Com_rollback_to_savepoint

Com_savepoint
Com_select

Com_set_option
Com_show_authors
Com_show_binlog_events
Com_show_binlogs
Com_show_charsets
Com_show_collations
Com_show_contributors
Com_show_create_db
Com_show_create_event
Com_show_create_func
Com_show_create_proc
Com_show_create_table
Com_show_create_trigger
Com_show_databases----執行show databases次數(監控)
Com_show_engine_logs
Com_show_engine_mutex
Com_show_engine_status
Com_show_errors
Com_show_events
Com_show_fields
Com_show_function_code
Com_show_function_status
Com_show_grants
Com_show_keys
Com_show_logs
Com_show_master_status
Com_show_new_master
Com_show_open_tables
Com_show_plugins
Com_show_privileges
Com_show_procedure_code
Com_show_procedure_status
Com_show_processlist
Com_show_profile
Com_show_profiles
Com_show_relaylog_events
Com_show_slave_hosts
Com_show_slave_status
Com_show_status
Com_show_storage_engines
Com_show_table_status
Com_show_tables
Com_show_triggers
Com_show_variables
Com_show_warnings
Com_signal
Com_slave_start
Com_slave_stop
Com_stmt_close
Com_stmt_execute
Com_stmt_fetch
Com_stmt_prepare
Com_stmt_reprepare
Com_stmt_reset
Com_stmt_send_long_data
Com_truncate  (監控)
Com_uninstall_plugin
Com_unlock_tables(監控1)
Com_update  MySQL更新的數量,能夠用來統計qps,qps計算公式:questions / uptime 或者基於com_%計算:Com_select/s + Com_insert/s + Com_update/s + Com_delete/s(監控)
Com_update_multi
Com_xa_commit
Com_xa_end
Com_xa_prepare
Com_xa_recover
Com_xa_rollback
Com_xa_start

七、

Connections 試圖鏈接MySQL服務器的次數

八、

Created_tmp_tables 當執行語句時,已經被創造了的隱含臨時表的數量。

Created_tmp_disk_tables

關於這兩個值是:

        mysql> show global status like 'created_tmp%';
        +-------------------------+---------+
        | Variable_name            | Value    |
        +-------------------------+---------+
        | Created_tmp_disk_tables | 21197    |
        | Created_tmp_files        | 58       |
        | Created_tmp_tables       | 1771587 |
        +-------------------------+---------+
每次建立臨時表,Created_tmp_tables增長,若是是在磁盤上建立臨時表,Created_tmp_disk_tables也增長,Created_tmp_files表示MySQL服務建立的臨時文件文件數,比較理想的配置是:
        Created_tmp_disk_tables / Created_tmp_tables * 100% <= 25%
好比上面的服務器Created_tmp_disk_tables / Created_tmp_tables * 100% = 1.20%,應該至關好了。咱們再看一下MySQL服務器對臨時表的配置:
        mysql> show variables where Variable_name in ('tmp_table_size', 'max_heap_table_size');
        +---------------------+-----------+
        | Variable_name        | Value      |
        +---------------------+-----------+
        | max_heap_table_size | 268435456 |
        | tmp_table_size       | 536870912 |
        +---------------------+-----------+
只有256MB如下的臨時表才能所有放內存,超過的就會用到硬盤臨時表。

九、

Delayed_insert_threads 正在使用的延遲插入處理器線程的數量。
Delayed_writes 用INSERT DELAYED寫入的行數。
Delayed_errors 用INSERT DELAYED寫入的發生某些錯誤(可能重複鍵值)的行數

十、
Flush_commands 執行FLUSH命令的次數 (監控)

十一、

Handler_delete 請求從一張表中刪除行的次數。(監控)
Handler_read_first 請求讀入表中第一行的次數。
Handler_read_key 請求數字基於鍵讀行。
Handler_read_next 請求讀入基於一個鍵的一行的次數。
Handler_read_rnd 請求讀入基於一個固定位置的一行的次數。
Handler_update 請求更新表中一行的次數。(監控)
Handler_write 請求向表中插入一行的次數。(監控)

十二、

Key_blocks_used 用於關鍵字緩存的塊的數量。
Key_read_requests 請求從緩存讀入一個鍵值的次數。
Key_reads 從磁盤物理讀入一個鍵值的次數。(監控)
Key_write_requests 請求將一個關鍵字塊寫入緩存次數。
Key_writes 將一個鍵值塊物理寫入磁盤的次數(監控)

1三、

Max_used_connections 同時使用的鏈接的最大數目。(監控)
Not_flushed_key_blocks 在鍵緩存中已經改變可是還沒被清空到磁盤上的鍵塊。
Not_flushed_delayed_rows 在INSERT DELAY隊列中等待寫入的行的數量。

1四、

Open_tables 打開表的數量。(監控)
Open_files 打開文件的數量。(監控)
Open_streams 打開流的數量(主要用於日誌記載)
Opened_tables 已經打開的表的數量

1五、

Questions 發往服務器的查詢的數量。(監控)
Slow_queries 要花超過long_query_time時間的查詢數量。
Threads_connected 當前打開的鏈接的數量。(監控)
Threads_running 不在睡眠的線程數量。(監控)
Uptime 服務器工做了多少秒。(監控)

相關文章
相關標籤/搜索