MySQLのチューニングツールとして、以前のブログで「mMeasure」というのを紹介したが、あらたに「MySQLTuner」というツールを見つけたので紹介します。
このツールは、シェル上からコマンドラインとして使うツールです。
以下のようにインストールしましょう。
# wget http://mysqltuner.com/mysqltuner.pl
# chmod +x mysqltuner.pl
上記のように実行権をつけたら、実行します。
# ./mysqltuner.pl
すると以下のような結果が帰ってきます。
[root@sv1 bin]# ./mysqltuner.pl >> MySQLTuner 0.9.9 - Major Hayden <major@mhtx.net> >> Bug reports, feature requests, and downloads at http://mysqltuner.com/ >> Run with '--help' for additional options and output filtering Please enter your MySQL administrative login: root Please enter your MySQL administrative password: -------- General Statistics -------------------------------------------------- [--] Skipped version check for MySQLTuner script [OK] Currently running supported MySQL version 5.0.27-log [OK] Operating on 32-bit architecture with less than 2GB RAM -------- Storage Engine Statistics ------------------------------------------- [--] Status: -Archive +BDB -Federated +InnoDB -ISAM -NDBCluster [--] Data in MyISAM tables: 184M (Tables: 61) [!!] InnoDB is enabled but isn't being used [!!] BDB is enabled but isn't being used [!!] Total fragmented tables: 16 -------- Performance Metrics ------------------------------------------------- [--] Up for: 34d 12h 39m 46s (18M q [6.104 qps], 317K conn, TX: 1B, RX: 1B) [--] Reads / Writes: 88% / 12% [--] Total buffers: 276.0M global + 2.8M per thread (50 max threads) [OK] Maximum possible memory usage: 416.2M (43% of installed RAM) [OK] Slow queries: 0% (4K/18M) [!!] Highest connection usage: 100% (51/50) [OK] Key buffer size / total MyISAM indexes: 200.0M/56.6M [OK] Key buffer hit rate: 100.0% (818M cached / 19K reads) [OK] Query cache efficiency: 67.7% (11M cached / 16M selects) [!!] Query cache prunes per day: 44250 [OK] Sorts requiring temporary tables: 4% (32K temp sorts / 750K sorts) [OK] Temporary tables created on disk: 0% (5K on disk / 906K total) [OK] Thread cache hit rate: 99% (193 created / 317K connections) [OK] Table cache hit rate: 93% (272 open / 292 opened) [OK] Open file limit used: 34% (351/1K) [OK] Table locks acquired immediately: 99% (8M immediate / 8M locks) -------- Recommendations ----------------------------------------------------- General recommendations: Add skip-innodb to MySQL configuration to disable InnoDB Add skip-bdb to MySQL configuration to disable BDB Run OPTIMIZE TABLE to defragment tables for better performance Reduce or eliminate persistent connections to reduce connection usage Variables to adjust: max_connections (> 50) wait_timeout (< 28800) interactive_timeout (< 28800) query_cache_size (> 50M)
Recommendations 以下におすすめの設定値(my.cnf)が出てきます。
上記の結果の場合、my.cnfに、
max_connections = 100
wait_timeout = 20000
interactive_timeout = 20000
query_cache_size = 100M
という感じで記述して、もう一回試してみればいいかもしれない。
また、[!!]のところは変更する必要がある箇所のようです。
私の環境ではあまりアラート的なものは出なかったが、以下のサイトでけっこう詳しく書いてあるので参照していただきたい。
翔泳社
売り上げランキング: 4778
毎日コミュニケーションズ
売り上げランキング: 41260
Similar Posts:
- AutoMySQLBackupを導入(MySQL全体をバックアップ)
- 「mysql」ではなく「mysql-server」だった
- Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’
- MAMP環境CakePHP1.2のbakeでSQL接続エラー
- logwatchの古くなったテンポラリーファイル
- どなたかお助けを(^^;) (・・・not a valid MySQL-Link・・・・)
- MovableType 4.2 アップグレード失敗?(カスタムフィールド消失)
- cronのリダイレクト
- yumでFC6からFC7へアップグレード
- サーバーのハードディスクがお亡くなりに。。。
- Newer: 今日から4年目
- Older: アニメ「AKIRA」のBlu-Ray Disc 2009年2月20日に発売
Comments:0
Trackbacks:0
- Trackback URL for this entry
- http://www.multiburst.net/ElectricBrain/2008/09/mysqltunermysql/trackback
- Listed below are links to weblogs that reference
- MySQLTunerでMySQLをチューニング from ElectronicBrain is eating BreakFast

