Redhat系ディストリビューションならEPELレポジトリを使ってインストールすることができます。
# yum install mysqltuner
インストールが完了後、下記コマンドで実行する。
赤字は任意で変更!
# mysqltuner --user *user* --pass *password* >> MySQLTuner 1.2.0 - Major Hayden>> Bug reports, feature requests, and downloads at http://mysqltuner.com/ >> Run with '--help' for additional options and output filtering [OK] Logged in using credentials passed on the command line -------- General Statistics -------------------------------------------------- [--] Skipped version check for MySQLTuner script [OK] Currently running supported MySQL version 5.5.38-log [OK] Operating on 64-bit architecture -------- Storage Engine Statistics ------------------------------------------- [--] Status: +Archive -BDB -Federated +InnoDB -ISAM -NDBCluster [--] Data in InnoDB tables: 12M (Tables: 38) [--] Data in MyISAM tables: 11M (Tables: 8) [--] Data in PERFORMANCE_SCHEMA tables: 0B (Tables: 17) [!!] Total fragmented tables: 7 -------- Security Recommendations ------------------------------------------- [OK] All database users have passwords assigned -------- Performance Metrics ------------------------------------------------- [--] Up for: 2d 17h 5m 37s (7M q [29.946 qps], 1K conn, TX: 7B, RX: 575M) [--] Reads / Writes: 98% / 2% [--] Total buffers: 4.1G global + 8.8M per thread (256 max threads) [OK] Maximum possible memory usage: 6.2G (9% of installed RAM) [OK] Slow queries: 0% (0/7M) [OK] Highest usage of available connections: 3% (9/256) [OK] Key buffer size / total MyISAM indexes: 8.0M/10.8M [OK] Key buffer hit rate: 100.0% (881M cached / 45K reads) [OK] Query cache efficiency: 65.9% (4M cached / 6M selects) [!!] Query cache prunes per day: 143882 [OK] Sorts requiring temporary tables: 0% (0 temp sorts / 3K sorts) [OK] Temporary tables created on disk: 0% (0 on disk / 279 total) [OK] Thread cache hit rate: 99% (9 created / 1K connections) [OK] Table cache hit rate: 93% (93 open / 100 opened) [OK] Open file limit used: 4% (73/1K) [OK] Table locks acquired immediately: 99% (2M immediate / 2M locks) [OK] InnoDB data size / buffer pool: 12.6M/4.0G -------- Recommendations ----------------------------------------------------- General recommendations: Run OPTIMIZE TABLE to defragment tables for better performance Variables to adjust: query_cache_size (> 16M)
基本的には my.cnf ファイルに対して修正・追加などを行う。
「Run OPTIMIZE TABLE to defragment tables for better performance」と出てるのですが、下記コマンドで自動実行が出来る。
# systemctl stop httpd # mysqlcheck -u root -p --auto-repair --optimize --all-databases # systemctl start httpd
0 件のコメント:
コメントを投稿