Tunning-Mysql
Ir para navegação
Ir para pesquisar
Sobre
Olá! Visitante, reunimos aqui, informações sobre o processo de Tunning no Mysql, este procedimento tende a aumentar o desempenho de leitura e escrita em Banco, assim aumentando a performance geral do sistema de Banco de Dados em Mysql. Estes ajustes podem auxiliar em momentos que algum sistema ou rede tenham gargalo, ou até mesmo evita um upgrade desnecessário de infra.
Otimizando Mysql
- Baixar o Mysql tunner
wget http://mysqltuner.pl/ -O mysqltuner.pl wget https://raw.githubusercontent.com/major/MySQLTuner-perl/master/basic_passwords.txt -O basic_passwords.txt
- Executar Teste
perl mysqltuner.pl
- Ajustar arquivo my.cf conforme saída do teste
nano etc/mysql/my.cf
- exemplo de saída
-------- Recommendations --------------------------------------------------------------------------- General recommendations: Dedicate this server to your database for highest performance. Reduce or eliminate unclosed connections and network issues Configure your accounts with ip or subnets only, then update your configuration with skip-name-resolve=1 When making adjustments, make tmp_table_size/max_heap_table_size equal Reduce your SELECT DISTINCT queries which have no LIMIT clause Performance schema should be activated for better diagnostics Consider installing Sys schema from https://github.com/mysql/mysql-sys Before changing innodb_log_file_size and/or innodb_log_files_in_group read this: http://bit.ly/2wgkDvS Variables to adjust: query_cache_size (=0) query_cache_type (=0) tmp_table_size (> 16M) max_heap_table_size (> 16M) performance_schema = ON enable PFS innodb_log_file_size should be (=16M) if possible, so InnoDB total log files size equals to 25% of buffer pool size. innodb_buffer_pool_instances (=1)
- Exemplo de ajustes no Arquivo
query_cache_limit = 1M #query_cache_size = 16M query_cache_size = 0 max_heap_table_size = 16M performance_schema = ON query_cache_size = 0 query_cache_type = 0 innodb_log_file_size = 16M innodb_buffer_pool_instances = 1
- Reiniciar o serviço do Mysql após ajustes
/etc/init.d/mysql restart