監控mysql鎖定狀態 mysql常用監控命令

2021-10-17 02:14:22 字數 2503 閱讀 2065

adb pull /sdcard/walktour/xycrash e:\qqqqqq

adb shell rm /sdcard/walktour/xycrash/*.log

# 1 鏈結數

select host,count(host) from information_schema.processlist group by host;

# 2 檢視資料庫 大小

select table_schema,round(sum(data_length+index_length)/1024/1024,4) from information_schema.tables group by table_schema;

# 3 mysql key buffer 命中率 key_buffer_read_hits = (1 - key_reads / key_read_requests)

# * 100% key_buffer_write_hits= (1 - key_writes / key_write_requests) * 100%

show /*!50000 global */ status like "key%";

# 4 mysql innodb buffer 命中率 innodb_buffer_read_hits=(1-innodb_buffer_pool_reads/

#innodb_buffer_pool_read_requests) * 100%

show /*!50000 global */ status like "innodb_buffer_pool_read%";

#5 mysql query cache 命中率 query_cache_hits= (qcache_hits / (qcache_hits

# + qcache_inserts)) * 100%

show /*!50000 global */ status like "qcache%";

#6 mysql table cache 狀態量

show /*!50000 global */ status like "open%";

#7 mysql thread cache 命中率 thread_cache_hits = (1 - threads_created /

#connections) * 100% 正常來說,thread cache 命中率要在 90% 以上才算比較合理。

show /*!50000 global */ status like "thread%";

#8 mysql binlog cache 使用狀況:binlog cache 用於存放還未寫入磁碟的 binlog 信 息 。

show /*!50000 global */ status like "binlog_cache%";

#9 mysql nnodb_log_waits 量:innodb_log_waits 狀態變數直接反應出 innodb log

#buffer 空間不足造成等待的次數

show /*!50000 global */ status like "innodb_log_waits";

#10 mysql tmp table 狀況 tmp table 的狀況主要是用於監控

#mysql 使用臨時表的量是否過多,是否有臨時表過大而不得不從記憶體中換出到磁碟檔案上

show /*!50000 global */ status like "created_tmp%";

#11 mysql 鎖定狀態:鎖定狀態包括表鎖和行鎖兩種,我們可以通過系統狀態變

#量獲得鎖定總次數,鎖定造成其他執行緒等待的次數,以及鎖定等待時間資訊

show /*!50000 global */ status like "%lock%";

mysql 預設的最大連線數為 100,可以在 mysql 客戶端使用以下命令檢視

mysql> show variables like 'max_connections';

要對 mysql 的最大連線數進行修改,有三種方法:

1.在 my.cnf 配置檔案裡面修改 max_connections 的值,然後重啟 mysql 就行。如果 my.ini 檔案中沒有找到 max_connections 條目,可自行新增以下條目:

max_connections = 200

2.命令列下執行 set global max_connections=200

3.修改源**

mysql伺服器允許的最大連線數16384,新增了最大允許連線數,對系統消耗增加不

其他狀態查詢命令:

顯示當前執行的執行緒:mysql> show processlist;

show full processlist;

顯示當前狀態:mysql> show status

顯示安裝後的可用儲存引擎和預設引擎 :show engines;

檢視各個表的數量 test001 為庫名

use information_schema;

select table_name,table_rows from tables

where table_sch

監控mysql鎖定狀態 MYSQL 表鎖情況檢視

檢視鎖表情況 mysql show status like table variable name value table locks immediate 795505 table locks waited 0 table open cache hits 0 table open cache mis...

監控mysql狀態 監控mysql狀態指令碼

監控mysql狀態,發現宕後,自動重啟,每秒檢查一次。check.sh bin bash while true do bin sleep 1 sh mysql status.sh done chengkill bin sh pid kill thread for chenglee if filefo...

MySQL鎖定狀態檢視命令

show processlist顯示哪些執行緒正在執行。您也可以使用mysqladmin processlist語句得到此資訊。如果您有super許可權,您可以看到所有執行緒。否則,您只能看到您自己的執行緒 也就是,與您正在使用的mysql賬戶相關的執行緒 如果有執行緒在update或者insert...