Fazendo um ajuste leve no MariaDB com mysqltuner
Olá, sou um incompetente.
Para passar o tempo, enquanto procurava algo para mexer no MariaDB, encontrei e instalei um software de ajuste de MySQL chamado mysqltuner.
Instalação
No Devuan, instale da seguinte forma:
sudo apt install mysqltuner
Execução
Começa de forma interativa, assim:
$ mysqltuner
>> MySQLTuner 1.9.9
* Jean-Marie Renouard <jmrenouard@gmail.com>
* Major Hayden <major@mhtx.net>
>> Bug reports, feature requests, and downloads at http://mysqltuner.pl/
>> Run with '--help' for additional options and output filtering
[--] Skipped version check for MySQLTuner script
Please enter your MySQL administrative login: root
Please enter your MySQL administrative password:
No final, apareceu algo assim:
General recommendations:
You are using n unsupported version for production environments
Upgrade as soon as possible to a supported version !
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
We will suggest raising the 'join_buffer_size' until JOINs not using indexes are found.
See https://dev.mysql.com/doc/internals/en/join-buffer-size.html
(specially the conclusions at the bottom of the page).
Performance schema should be activated for better diagnostics
Before changing innodb_log_file_size and/or innodb_log_files_in_group read this: https://bit.ly/2TcGgtU
Variables to adjust:
skip-name-resolve=1
join_buffer_size (> 256.0K, or always use indexes with JOINs)
table_definition_cache(400) > 585 or -1 (autosizing if supported)
performance_schema=ON
innodb_buffer_pool_size (>= 1.3G) if possible.
innodb_log_file_size should be (=32M) if possible, so InnoDB total log files size equals 25% of buffer pool size.
Parece que é melhor pular a resolução de nomes DNS.
※Parece ser uma armadilha, então se você estiver usando user@localhost no MariaDB, talvez seja melhor não fazer isso: Quando você escreve skip-name-resolve e não consegue se conectar ao DB – netcreates. blog
Então, usei grep -r mysqld para encontrar o arquivo conf da seção alvo e, como o caminho era /etc/mysql/mariadb.conf.d/50-server.cnf , adicionei-o.
E, como parece que é melhor ajustar o tamanho de join_buffer_size, vou alterá-lo.
Também parece que é melhor configurar o cache de definição de tabela, então vou alterá-lo.
Parece que é melhor especificar o tamanho do log do innodb para que não cresça demais.
Também especifiquei o tamanho do pool do innodb, mas o mantive bem pequeno.
[mysqld]
skip-name-resolve=1
join_buffer_size = 512K
table_definition_cache = 600
innodb_log_file_size = 32M
innodb_buffer_pool_size = 2G
Se já estiver comentado na sintaxe, descomente-o, aplique as configurações acima e reinicie o MariaDB.
sudo service mariadb restart
E o resultado de executar mysqltuner novamente.
General recommendations:
You are using n unsupported version for production environments
Upgrade as soon as possible to a supported version !
MySQL was started within the last 24 hours - recommendations may be inaccurate
We will suggest raising the 'join_buffer_size' until JOINs not using indexes are found.
See https://dev.mysql.com/doc/internals/en/join-buffer-size.html
(specially the conclusions at the bottom of the page).
Performance schema should be activated for better diagnostics
Before changing innodb_log_file_size and/or innodb_log_files_in_group read this: https://bit.ly/2TcGgtU
Variables to adjust:
join_buffer_size (> 512.0K, or always use indexes with JOINs)
performance_schema=ON
innodb_log_file_size should be (=512M) if possible, so InnoDB total log files size equals 25% of buffer pool size.
Não quero ativar o performance_schema, e como não há mais nada que pareça muito rigoroso, vou parar por aqui por enquanto.
Isso é tudo por agora. Até a próxima.