Optimizar MySQL con MySQL Tuner

por David Abad
Optimizar MySQL

MySQL Tuner es un script capaz de revisar la configuración de nuestra base de datos MySQL para indicarnos las optimizaciones necesarias para conseguir un mejor rendimiento.

Compatibilidad

MySQL Tuner es un script escrito en Perl para sistemas Linux y compatible con todas las siguientes versiones de base de datos:

  • MySQL: 8.0, 5.7, 5.6, 5.5, 5.1, 5.0, 4.1, 4.0, 3.2.

  • Percona Server: 8.0, 5.7, 5.6.

  • MariaDB: 10.5, 10.4, 10.3, 10.2, 10.1, 10.0, 5.5.

Usar MySQL Tuner

1. Instalar software necesario:

sudo apt-get install wget perl

2. Descargar MySQL Tuner:

wget http://mysqltuner.pl/ -O mysqltuner.pl
wget https://raw.githubusercontent.com/major/MySQLTuner-perl/master/basic_passwords.txt -O basic_passwords.txt
wget https://raw.githubusercontent.com/major/MySQLTuner-perl/master/vulnerabilities.csv -O vulnerabilities.csv

3. Lanzar MySQL Tuner:

perl mysqltuner.pl --host <db_host> --user <db_user> --pass <db_password>

Resultado

Como resultado, MySQL Tuner devuelve una serie de recomendaciones y variables a modificar para mejorar el rendimiento y la seguridad de nuestra base de datos.
-------- Recommendations ---------------------------------------------------------------------------
General recommendations:
33 CVE(s) found for your MySQL release. Consider upgrading your version !
MySQL was started within the last 24 hours - recommendations may be inaccurate
Reduce your overall MySQL memory footprint for system stability
Dedicate this server to your database for highest performance.
Reduce or eliminate unclosed connections and network issues
Consider installing Sys schema from https://github.com/mysql/mysql-sys for MySQL
Consider installing Sys schema from https://github.com/FromDual/mariadb-sys for MariaDB
Before changing innodb_log_file_size and/or innodb_log_files_in_group read this: https://bit.ly/2TcGgtU
Variables to adjust:
*** MySQL's maximum memory usage is dangerously high ***
*** Add RAM before increasing MySQL buffer variables ***
innodb_log_file_size should be (=16M) if possible, so InnoDB total log files size equals to 25% of buffer pool size.
Es importante destacar que estas recomendaciones no son aplicadas automáticamente por MySQL Tuner, sino que deben ser aplicadas manualmente a posteriori.

Déjanos tu email para recibir contenido interesante en tu bandeja de entrada, cada mes.

¡No hacemos spam!

Otros artículos