Tuning Mysql/MariaDB
Posted: Fri Oct 27, 2017 10:22 am
Hi,
I want to tune MariaDB to get better result with Nagios DB. I use MySQLTuner 1.7.4 - Major Hayden <[email protected]> http://mysqltuner.com/.
My current my.cnf
I plan to use that custom configuration. I want to know if Nagios have advice. What I can use and what you discourage to use.
New my.cnf
Increase mariadb max_connections
Ajusting some sysctl config
I want to tune MariaDB to get better result with Nagios DB. I use MySQLTuner 1.7.4 - Major Hayden <[email protected]> http://mysqltuner.com/.
My current my.cnf
Code: Select all
[mysqld]
query_cache_size=16M
query_cache_limit=4M
tmp_table_size=64M
max_heap_table_size=64M
key_buffer_size=32M
table_open_cache=32
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd
[mysqld_safe]
log-error=/var/log/mariadb/mariadb.log
pid-file=/var/run/mariadb/mariadb.pid
#
# include all files from the config directory
#
!includedir /etc/my.cnf.d
New my.cnf
Code: Select all
[mysqld]
query_cache_type=1
query_cache_min_res_unit = 2k
query_cache_limit=4M
query_cache_size=80M
tmp_table_size=64M
max_heap_table_size=64M
key_buffer_size=32M
table_open_cache=32
innodb_file_per_table=1
innodb_log_file_size=16M
thread_cache_size=16
# Skip reverse DNS lookup of clients
skip-name-resolve
slow-query-log = 1
slow-query-log-file = /var/lib/mysql/mysql-slow.log
long_query_time = 1
#The default value is 28800 seconds
wait_timeout=60
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd
[mysqld_safe]
log-error=/var/log/mariadb/mariadb.log
pid-file=/var/run/mariadb/mariadb.pid
#
# include all files from the config directory
#
!includedir /etc/my.cnf.d
Code: Select all
# mysql -u root -p
mysql> set global max_connections := 500;
Code: Select all
vm.swappiness=0
fs.aio-max-nr=1048576
8-)