天天看點

使用mysqlreport檢視Mysql資料庫資訊

mysqlreport是開發的一款基于perl語言編寫的狀态報告工具。

它将show status 和 show innodb status的輸出結果進行處理,使得輸出資訊的可讀性更高。由于是perl編寫的腳本,是以需要先安裝perl環境,再與mysql資料庫連接配接,是以還需要安裝資料庫接口DBI 和資料庫驅動 DBD-Mysql.

安裝perl-DBI

安裝mysqlreport

install_driver(mysql) failed: Can‘t locate DBD/mysql.pm in @INC (@INC contains: /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.8.8/i386-linux-thread-multi /usr/lib/perl5/5.8.8 .) at (eval 8) line 3.

Perhaps the DBD::mysql perl module hasn‘t been fully installed,

or perhaps the capitalisation of ‘mysql‘ isn‘t right.

Available drivers: DBM, ExampleP, File, Proxy, Sponge.

 at ./mysqlreport line 249

出現以上錯誤,原因是沒有安裝DBD-mysql,下載下傳安裝

把mysql的這個庫檔案路徑添加進去

再使用mysqlreport

腳本有些小的bug,會出現以下錯誤資訊

829行修改成如下方式,則不再提示錯誤

再分析1227和1235行錯誤

檢視mysql官方手冊

Innodb_buffer_pool_pages_latched

The number of latched pages in InnoDB buffer pool. These are pages currently being read or written or that cannot be flushed or removed for some other reason. Calculation of this variable is expensive, so as of MySQL 5.1.28, it is available only when the UNIV_DEBUG system is defined at server build time.

5.1.28後不預設提供這個參數了。除非編譯的時候強制指定。

Innodb_buffer_pool_read_ahead_seq

The number of sequential read-aheads initiated by <code>InnoDB</code>. This happens when <code>InnoDB</code> does a sequential full table scan. 

For <code>InnoDB Plugin</code>, this variable was removed in MySQL 5.1.41.

這個變量是InnoDB的存儲引擎插件,在5.1.41以後就已經被移除,這裡我的資料庫是5.5.25,是以以上兩個錯誤不是很重要。

最後執行mysqlreport -u -password 12345看看,以下是部分輸出結果的顯示

本文出自 “” 部落格,謝絕轉載!

繼續閱讀