Mariadb

MariaDB 10.3.27 記憶體使用問題

  • March 3, 2021

問候!

我嘗試使用 my.cnf 優化 MariaDB 配置。一切都很好,但可用記憶體每小時都在下降。我在同一台伺服器上使用 MariaDB 和 Zabbix 伺服器。CPU:4 核,RAM:8 GB(之前是 4 GB,還可以),硬碟:128 GB。

你能告訴我我應該解決什麼嗎?

[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

這些是危險的大;將它們降低到大約 1% 的 RAM。

tmp_table_size                  = 256M
max_heap_table_size             = 256M

一些分配的空間逐漸增長,直到達到從設置或設置組合派生的限制。

你在那台機器上除了 MySQL 之外還有其他東西執行嗎?如果沒有,我不希望它填滿 8GB。

引用自:https://dba.stackexchange.com/questions/286216