MySQL Aborted_clients和 Aborted_connects状态变量详解
Aborted_clients和 Aborted_connects狀態變量詳解
By:授客 QQ:1033553122
狀態變量定義
Aborted_clients
因客戶端消亡時未恰當的關閉連接而引起的被中斷連接數
The number of connections that were aborted because the client died without closing the connection properly.
Aborted_connects
連接MySQL服務器失敗的次數。
The number of failed attempts to connect to the MySQL server。
參考鏈接:
https://dev.mysql.com/doc/refman/5.5/en/server-status-variables.html
狀態變量數值分析
查看變量值
SHOW GLOBAL STATUS LIKE 'Aborted_connects'
SHOW GLOBAL STATUS LIKE 'Aborted_clients'
Aborted_connects
如果客戶端連接mysql服務器失敗,那么服務器會增加Aborted_connect變量的值,每失敗一次,變量值加1。
以下幾種情況會導致Aborted_connect變量值增加。
l 客戶端因為沒有權限訪問數據庫導致的連接失敗
l 客戶端因為密碼錯誤導致的連接失敗
l 連接包(connection packet)沒有包含正確的信息導致的連接失敗
l 獲取連接包耗費多余connect_timeout系統變量設置的時間導致的連接失敗,即連接超時(查看變量值SHOW GLOBAL VARIABLES LIKE 'connect_timeout';
Aborted_clients
如果客戶端成功連接,但是沒有以恰當的方式斷開連接,或者是被中斷,那么服務器會增加Aborted_clients狀態變量的值,每次加1,并記錄一條Aborted connection消息到錯誤日志。
以下幾種情況會導致Aborted_clients狀態變量值增加。
l 客戶端退出之前,沒有調用mysql_close()
l 客戶端“沉睡”,超過wait_timeout 或者 interactive_timeout設置時間(單位:秒)沒有向服務器發起任何請求。
l 客戶端程序在數據傳輸的期間突然終止。
導致aborted connections 或者aborted clients的其它原因
l max_allowed_packet 狀態變量的值設置太小,或者查詢需要消耗的內存比已經分配給mysqld的內存更大。查看SectionB.5.2.10, “Packet Too Large”。
l Linux使用的Ethernet協議,包含半雙工和全雙工。有些Linux Ethernet驅動存在這個bug。You should test for this bug by transferring a huge file using FTP between the client and server machines. If a transfer goes in burst-pause-burst-pause mode, you are experiencing a Linux duplex syndrome. Switch the duplex mode for both your network card and hub/switch to either full duplex or to half duplex and test the results to determine the best setting.
l 線程類庫存在問題導致讀取中斷。
l TCP/IP配置錯誤。
l Ethernets, hubs, switches, cables等故障,這些只能更換硬件。
參考鏈接:
https://dev.mysql.com/doc/refman/5.5/en/communication-errors.html
總結
以上是生活随笔為你收集整理的MySQL Aborted_clients和 Aborted_connects状态变量详解的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: [.Net 多线程处理系列专题七——对多
- 下一篇: 传输层-Transport Layer(