溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

mysqladmin extended-status總結(jié)

發(fā)布時間:2020-05-21 20:42:37 來源:網(wǎng)絡 閱讀:1086 作者:拎壺沖沖沖 欄目:MySQL數(shù)據(jù)庫

1、

Aborted_clients 由于客戶沒有正確關(guān)閉連接已經(jīng)死掉,已經(jīng)放棄的連接數(shù)量。(做監(jiān)控)

????表示客戶端沒有正確的關(guān)閉連接,而被終止的連接數(shù),引起的原因
????1.客戶端程序退出之前未調(diào)用mysql_close()來關(guān)閉mysql連接
????2.客戶端的休眠時間超過了mysql系統(tǒng)變量wait_timeout和interactive_timeout的值,導致連接被mysql進程終止
????3.客戶端程序在數(shù)據(jù)傳輸過程中突然結(jié)束

2、

Aborted_connects 嘗試已經(jīng)失敗的MySQL服務器的連接的次數(shù)。(做監(jiān)控)


????表示嘗試連接到mysql服務器的失敗次數(shù),可以結(jié)合host_cache來分析問題,引起的原因:
????1.密碼錯誤??
????2.沒權(quán)限訪問,但是嘗試去訪問
????3.連接超時
????4.連接信息不正確

如果碰到連接超時等信息一定要分析一下是什么原因引起的

在MySQL服務器使用tcpdump抓包

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

然后在另外一臺MySQL服務器,使用不存在的賬號或錯誤的密碼訪問MySQL數(shù)據(jù)庫

# mysql -h xx.xx.xx.xx -u xxx? -pxxxx

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

# 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~]#

?

執(zhí)行完命令后,你可以使用CTRL + C結(jié)束抓包分析,然后查看分析。如下截圖所示:

?

[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

3、

Binlog_cache_disk_use表示因為我們binlog_cache_size設(shè)計的內(nèi)存不足導致緩存二進制日志用到了臨時文件的次數(shù)(做監(jiān)控)

4、

Binlog_cache_use? 表示 用binlog_cache_size緩存的次數(shù)

當對應的Binlog_cache_disk_use 值比較大的時候 我們可以考慮適當?shù)恼{(diào)高 binlog_cache_size 對應的值

沒有什么大事務,dml也不是很頻繁的情況下可以設(shè)置小一點,如果事務大而且多,dml操作也頻繁,則可以適當?shù)恼{(diào)大一點。

前者建議是1048576? --1M

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

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

注意:

(1)max_binlog_cache_size 表示的是binlog 能夠使用的最大cache 內(nèi)存大小

當我們執(zhí)行多語句事務的時候 所有session的使用的內(nèi)存超過max_binlog_cache_size的值時

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

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

調(diào)整方式(兩種辦法):

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

binlog_cache_size?=?1M

(2)set global binlog_cache_size = 1048576

解釋:

show status like '%binlog%';

stmt就是statement的意思

Binlog_cache_disk_use ?。ㄊ聞疹悾?/span>二進志日志緩存的已經(jīng)存在硬盤的條數(shù)?

Binlog_cache_use   ?。ㄊ聞疹悾┒M制日志已緩存的條數(shù)(內(nèi)存中) ? ?注意,這個不是容量,而是事務個數(shù)。每次有一條事務提交,都會有一次增加

Binlog_stmt_cache_disk_use ?(非事務類)二進志日志緩存的已經(jīng)存在硬盤的條數(shù) ?

Binlog_stmt_cache_use??(非事務類)二進制日志已緩存的條數(shù)(內(nèi)存中)?非事務型的語句,都存在這兒,比如MYISAM引擎的表,插入記錄就存在這兒

參數(shù)衍生:

binlog_cache_use和binlog_cache_disk_use兩者結(jié)合可以用來調(diào)整binlog_cache_size的大小
binglog_stmt_cache_use和binlog_stmt_cache_disk_use兩者結(jié)合可以有來調(diào)整 binlog_stmt_cache_size的大小

5、

Bytes_received/Bytes_sent(做監(jiān)控)

看 mysql總的吞吐量

Bytes_received
從所有客戶端接收到的字節(jié)數(shù)。結(jié)合bytes sent, 可以作為數(shù)據(jù)庫網(wǎng)卡吞吐量的評測指標,單位字節(jié)

Bytes_sent
發(fā)送給所有客戶端的字節(jié)數(shù)。結(jié)合bytes received,可以作為數(shù)據(jù)庫網(wǎng)卡吞吐量的評測指標,單位字節(jié)


6、

Com_admin_commands [ Com_xxx ]
Com_xxx 語句計數(shù)變量表示每個xxx 語句執(zhí)行的次數(shù)。每類語句有一個狀態(tài)變量。例如,Com_delete和Com_insert分別統(tǒng)計DELETE 和INSERT語句執(zhí)行的次數(shù)。
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提交的事務數(shù)量,可以用來統(tǒng)計TPS(每秒事務數(shù)),計算公式:Com_commit/S+Com_rollback/S(做監(jiān)控)

Com_create_db
Com_create_event
Com_create_function
Com_create_index
Com_create_procedure-------創(chuàng)建存儲過程個數(shù)(監(jiān)控)
Com_create_server
Com_create_table--------創(chuàng)建數(shù)據(jù)表個數(shù)(監(jiān)控)
Com_create_trigger
Com_create_udf
Com_create_user
Com_create_view
Com_dealloc_sql
Com_delete
??MySQL刪除的數(shù)量,可以用來統(tǒng)計qps,計算公式:questions / uptime 或者基于com_%計算:Com_select/s + Com_insert/s + Com_update/s + Com_delete/s(做監(jiān)控)

Com_delete_multi
Com_do
Com_drop_db? ? (做監(jiān)控)
Com_drop_event
Com_drop_function
Com_drop_index
Com_drop_procedure
Com_drop_server
Com_drop_table(做監(jiān)控)
Com_drop_trigger
Com_drop_user
Com_drop_view
Com_empty_query
Com_execute_sql
Com_flush
Com_grant(做監(jiān)控)
Com_ha_close
Com_ha_open
Com_ha_read
Com_help
Com_insert?
MySQL插入的數(shù)量,可以用來統(tǒng)計qps,qps計算公式:questions / uptime 或者基于com_%計算:Com_select/s + Com_insert/s + Com_update/s + Com_delete/s (做監(jiān)控)

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回滾的事務數(shù)量,可以用來統(tǒng)計TPS(每秒事務數(shù)),計算公式:Com_commit/S+Com_rollback/S (監(jiān)控)

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----執(zhí)行show databases次數(shù)(監(jiān)控)
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? (監(jiān)控)
Com_uninstall_plugin
Com_unlock_tables(監(jiān)控1)
Com_update??MySQL更新的數(shù)量,可以用來統(tǒng)計qps,qps計算公式:questions / uptime 或者基于com_%計算:Com_select/s + Com_insert/s + Com_update/s + Com_delete/s(監(jiān)控)
Com_update_multi
Com_xa_commit
Com_xa_end
Com_xa_prepare
Com_xa_recover
Com_xa_rollback
Com_xa_start

7、

Connections 試圖連接MySQL服務器的次數(shù)

8、

Created_tmp_tables 當執(zhí)行語句時,已經(jīng)被創(chuàng)造了的隱含臨時表的數(shù)量。

Created_tmp_disk_tables

關(guān)于這兩個值是:

? ? ? ? mysql> show global status like 'created_tmp%';
? ? ? ? +-------------------------+---------+
? ? ? ? | Variable_name????????????| Value????|
? ? ? ? +-------------------------+---------+
? ? ? ? | Created_tmp_disk_tables | 21197????|
? ? ? ? | Created_tmp_files????????| 58???????|
? ? ? ? | Created_tmp_tables???????| 1771587 |
? ? ? ? +-------------------------+---------+
每次創(chuàng)建臨時表,Created_tmp_tables增加,如果是在磁盤上創(chuàng)建臨時表,Created_tmp_disk_tables也增加,Created_tmp_files表示MySQL服務創(chuàng)建的臨時文件文件數(shù),比較理想的配置是:
? ? ? ? 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以下的臨時表才能全部放內(nèi)存,超過的就會用到硬盤臨時表。

9、

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

10、
Flush_commands 執(zhí)行FLUSH命令的次數(shù) (監(jiān)控)

11、

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

12、

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

13、

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

14、

Open_tables 打開表的數(shù)量。(監(jiān)控)
Open_files 打開文件的數(shù)量。(監(jiān)控)
Open_streams 打開流的數(shù)量(主要用于日志記載)
Opened_tables 已經(jīng)打開的表的數(shù)量

15、

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







向AI問一下細節(jié)

免責聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI