Greetings!
I tried to optimize MariaDB configuration with my.cnf. Everything was OK, but available memory falling down each hour. I'm using MariaDB with Zabbix server on the same server. CPU: 4 Cores, RAM: 8 GB (before was 4 GB and it was OK), HDD: 128 GB.
Could you please tell me what should I fix?
[mysqld]
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
connect_timeout = 60
wait_timeout = 28800
max_connections = 200
max_allowed_packet = 64M
max_connect_errors = 1000
tmp_table_size = 256M
max_heap_table_size = 256M
table_open_cache = 1024
log_error = /var/log/mysql/mysql-error.log
slow_query_log_file = /var/log/mysql/mysql-slow.log
slow_query_log = 1
long_query_time = 5
innodb_file_per_table = 1
innodb_status_file = 1
innodb_buffer_pool_size = 5G
innodb_flush_method = O_DIRECT
innodb_io_capacity = 2000
innodb_log_file_size = 640M
innodb_log_buffer_size = 16M
innodb_buffer_pool_instances = 5
skip-external-locking
bind-address = 127.0.0.1
event_scheduler = 1
query_cache_type = 0
join_buffer_size = 256K
read_buffer_size = 256K
read_rnd_buffer_size = 256K
sort_buffer_size = 256K
key_buffer_size = 16M
thread_stack = 192K
thread_cache_size = 8
myisam-recover-options = BACKUP
query_cache_limit = 2M
query_cache_size = 128M
expire_logs_days = 10
max_binlog_size = 100M
Best Answer
These are dangerously big; lower them to about 1% of RAM.
Some of the allocated space gradually grows until it hits a limit derived from a setting or combination of settings.
Do you have anything other than MySQL running on that machine? If not, I don't expect it to fill up the 8GB.