Оптимизация mysql
Оптимизация mysql mysqltuner - утилита для оптимизации сервера mysql

Mysqltuner — это perl-скрипт, который анализирует статистику работы Mysql и выдает свои рекомендации по оптимизации настроек Mysql сервера. Скачать скрипт можно следующим образом:
1 | wget https: //raw .githubusercontent.com /major/MySQLTuner-perl/master/mysqltuner .pl |
1 2 3 | ERROR: cannot verify raw.githubusercontent.com 's certificate, issued by ' /C =US /O =DigiCert Inc /OU =www.digicert.com /CN =DigiCert SHA2 High Assurance Server CA': Unable to locally verify the issuer's authority. To connect to raw.githubusercontent.com insecurely, use `--no-check-certificate'. |
1 | wget https: //raw .githubusercontent.com /major/MySQLTuner-perl/master/mysqltuner .pl --no-check-certificate |
1 | make install clean BATCH= yes -C /usr/ports/databases/mysqltuner |
1 | apt-get -y install mysqltuner |
1 | yum -y install mysqltuner |
Теперь можно запускать Mysqltuner.
Если производилось скачивание скрипта:
1 | perl mysqltuner.pl |
1 | perl mysqltuner.pl --user root --pass rootpassword |
1 | mysqltuner |
1 | mysqltuner --user root --pass rootpassword |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | # perl mysqltuner.pl --user root --pass rootpassword >> 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 [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.33 [OK] Operating on 32-bit architecture with less than 2GB RAM -------- Storage Engine Statistics ------------------------------------------- [--] Status: -Archive -BDB -Federated +MyISAM -ISAM -NDBCluster [--] Data in PERFORMANCE_SCHEMA tables: 0B (Tables: 17) [!!] MyISAM is enabled but isn't being used [OK] Total fragmented tables: 0 -------- Security Recommendations ------------------------------------------- [OK] All database users have passwords assigned -------- Performance Metrics ------------------------------------------------- [--] Up for : 20h 45m 49s (101 q [0.001 qps], 7 conn, TX: 28K, RX: 3K) [--] Reads / Writes: 100% / 0% [--] Total buffers: 160.0M global + 832.0K per thread (151 max threads) [OK] Maximum possible memory usage: 282.7M (55% of installed RAM) [OK] Slow queries: 0% (0 /101 ) [OK] Highest usage of available connections: 1% (2 /151 ) [!!] Key buffer size / total MyISAM indexes: 16.0K /679 .0K [!!] Query cache is disabled [OK] Temporary tables created on disk: 3% (3 on disk / 94 total) [!!] Thread cache is disabled [!!] Table cache hit rate: 11% (4 open / 35 opened) [OK] Open file limit used: 0% (6 /7K ) [OK] Table locks acquired immediately: 100% (37 immediate / 37 locks) [!!] Connections aborted: 14% -------- Recommendations ----------------------------------------------------- General recommendations: Add skip-innodb to MySQL configuration to disable MyISAM MySQL started within last 24 hours - recommendations may be inaccurate Enable the slow query log to troubleshoot bad queries Set thread_cache_size to 4 as a starting value Increase table_cache gradually to avoid file descriptor limits Your applications are not closing MySQL connections properly Variables to adjust: key_buffer_size (> 679.0K) query_cache_size (>= 8M) thread_cache_size (start at 4) table_cache (> 4) |
Параметры указанные после строки Variables to adjust нужно изменить в файле my.cnf, в соответствии с рекомендациями Mysqltuner. Если указанного параметра нет в файле my.cnf, то его следует дописать.
Расположение конфигурационного файла my.cnf:
FreeBSD:
1 | /etc/my .cnf |
1 | /etc/mysql/my .cnf |
1 | /etc/my .cnf |
1 2 3 | Debian /Ubuntu : <script type = "syntaxhighlighter" class= "brush: bash" > /etc/init .d /mysql restart |
1 | /etc/init .d /mysqld restart |
2012-2025 © Web site development. Developed by ABCname