BlogBlog ÜbersichtjailscriptportsoptFreeBSDLinksThermoskanne

Informationen zu einer MySQL-Instanz erhalten

Mit Hilfe von mysqltuner lassen sich einige Informationen zu einer laufenden MySQL-Instanz auslesen. Im FreeBSD-Portbaum findet man mysqltuner unter databases/mysqltuner:

# cd /usr/ports/databases/mysqltuner && make install clean

Führt man das Skript aus, wird man nach einem MySQL-Benutzer und dessen Passwort gefragt und danach werden einige Tests durchgeführt. Im folgenden Beispiel sieht man zum Beispiel, dass drei MySQL-Benutzer kein Passwort zugewiesen haben und dass die MySQL-Instanz mehr Arbeitsspeicher konfiguriert hat, als auf dem System überhaupt vorhanden ist:

# mysqltuner.pl 

 >>  MySQLTuner 1.2.0 - 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.92-log
[!!] Switch to 64-bit OS - MySQL cannot currently use all of your RAM

-------- Storage Engine Statistics -------------------------------------------
[--] Status: -Archive -BDB -Federated +InnoDB -ISAM -NDBCluster 
[--] Data in MyISAM tables: 18M (Tables: 6)
[--] Data in InnoDB tables: 29M (Tables: 45)
[OK] Total fragmented tables: 0

-------- Security Recommendations  -------------------------------------------
[!!] User 'qat@localhost' has no password set.
[!!] User 'root@127.0.0.1' has no password set.
[!!] User 'tinderbox2@localhost' has no password set.

-------- Performance Metrics -------------------------------------------------
[--] Up for: 32d 20h 18m 43s (4M q [1.739 qps], 86K conn, TX: 2B, RX: 396M)
[--] Reads / Writes: 97% / 3%
[--] Total buffers: 458.0M global + 18.2M per thread (200 max threads)
[!!] Allocating > 2GB RAM on 32-bit systems can cause system instability
[!!] Maximum possible memory usage: 4.0G (104% of installed RAM)
[OK] Slow queries: 0% (0/4M)
[OK] Highest usage of available connections: 10% (21/200)
[OK] Key buffer size / total MyISAM indexes: 384.0M/979.0K
[OK] Key buffer hit rate: 99.5% (1M cached / 4K reads)
[!!] Query cache efficiency: 7.0% (91K cached / 1M selects)
[OK] Query cache prunes per day: 0
[OK] Sorts requiring temporary tables: 0% (0 temp sorts / 33K sorts)
[OK] Temporary tables created on disk: 6% (4K on disk / 68K total)
[OK] Thread cache hit rate: 99% (57 created / 86K connections)
[!!] Table cache hit rate: 3% (46 open / 1K opened)
[OK] Open file limit used: 0% (5/11K)
[OK] Table locks acquired immediately: 100% (2M immediate / 2M locks)
[!!] InnoDB data size / buffer pool: 29.9M/8.0M

-------- Recommendations -----------------------------------------------------
General recommendations:
    Increase table_cache gradually to avoid file descriptor limits
Variables to adjust:
  *** MySQL's maximum memory usage is dangerously high ***
  *** Add RAM before increasing MySQL buffer variables ***
    query_cache_limit (> 1M, or use smaller result sets)
    table_cache (> 2048)
    innodb_buffer_pool_size (>= 29M)

Weiter gibt mysqltuner einige Vorschläge an welchen Variablen noch Verbesserungen gemacht werden könnte, allerdings sollte man diese nur vornehmen, wenn man auch weiss was die Variable macht und was Änderung überhaupt bewirken wird. Alle Optionen von mysqltuner erhält man mit der --help Option.

 Permalink