
_圖片來自Percona官網_
今天同事在用?[percona toolkit](http://www.percona.com/software/percona-toolkit "percona toolkit")?工具中的?[pt-table-checksum](http://www.percona.com/doc/percona-toolkit/2.2/pt-table-checksum.html "pt-table-checksum")?對主從數據庫進行校驗,提交命令后,一直提示下面的信息:
~~~
Pausing because Threads_running=0
~~~
看字面意思是在提示當前活躍線程數為0,但為什么不繼續執行呢。這個提示信息有點含糊其辭,該工具是用Perl寫的,因此直接打開看腳本跟蹤一下,大概就明白怎么回事了,原來是這個工具有負載保護機制,避免運行時對線上數據庫產生影響。
和這個機制相關的參數名是:?–max-load,其類型是:Array,用法是一個或多個?variables = value?組成的判斷條件,然后根據這個規則判斷某些條件是否超標。例如,設定?–max-load=”Threads_running=25″,意思是當前活躍線程數如果超過25,就暫停 checksum 工作,直到活躍線程數低于 25。
因此,在我們這個案例中,想要強制讓 table-checksum 繼續工作的話,可以設定 –max-load 的值,例如:
~~~
pt-table-checksum --max-load="Threads_running=25" ...其他選項...
~~~
或者
~~~
pt-table-checksum --max-load="Threads_connected=25" ...其他選項...
~~~
前面的選項意思是判斷活躍線程數不要超過25個,后面的選項意思是當前打開的線程數不要超過25個。
下面是 pt-table-checksum 幫助手冊里的一段話:
> –max-load
> type: Array; default: Threads_running=25; group: Throttle
>
> Examine SHOW GLOBAL STATUS after every chunk, and pause if any status variables are higher than the threshold. The option accepts a comma-sep-
> arated list of MySQL status variables to check for a threshold. An optional “=MAX_VALUE” (or “:MAX_VALUE”) can follow each variable. If not
> given, the tool determines a threshold by examining the current value and increasing it by 20%.
>
> For example, if you want the tool to pause when Threads_connected gets too high, you can specify “Threads_connected”, and the tool will check
> the current value when it starts working and add 20% to that value. If the current value is 100, then the tool will pause when Threads_con-
> nected exceeds 120, and resume working when it is below 120 again. If you want to specify an explicit threshold, such as 110, you can use
> either “Threads_connected:110″ or “Threads_connected=110″.
>
> The purpose of this option is to prevent the tool from adding too much load to the server. If the checksum queries are intrusive, or if they
> cause lock waits, then other queries on the server will tend to block and queue. This will typically cause Threads_running to increase, and the
> tool can detect that by running SHOW GLOBAL STATUS immediately after each checksum query finishes. If you specify a threshold for this vari-
> able, then you can instruct the tool to wait until queries are running normally again. This will not prevent queueing, however; it will only
> give the server a chance to recover from the queueing. If you notice queueing, it is best to decrease the chunk time.
- 前言
- 為什么InnoDB表要建議用自增列做主鍵
- 線上環境到底要不要開啟query cache
- MySQL復制中slave延遲監控
- 如何安全地關閉MySQL實例
- 如何查看當前最新事務ID
- 從MyISAM轉到InnoDB需要注意什么
- 5.6版本GTID復制異常處理一例
- 不同的binlog_format會導致哪些SQL不會被記錄
- Spring框架中調用存儲過程失敗
- 如何將兩個表名對調
- mysqldump加-w參數備份
- 使用mysqldump備份時為什么要加上 -q 參數
- 修改my.cnf配置不生效
- 什么情況下會用到臨時表
- profiling中要關注哪些信息
- EXPLAIN結果中哪些信息要引起關注
- processlist中哪些狀態要引起關注
- MySQL無法啟動例一
- pt-table-checksum工具使用報錯一例
- 為什么要關閉query cache,如何關閉
- MySQL聯合索引是否支持不同排序規則
- SAVEPOINT語法錯誤一例
- 你所不知的table is full那些事
- 大數據量時如何部署MySQL Replication從庫
- 內存溢出案例