From bfa9caf54c455e93e95c5e79f7a910d61ee5ab93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=89=E5=AE=89=E7=A7=91=E6=8A=80?= Date: Thu, 1 Aug 2024 10:53:42 +0800 Subject: [PATCH] uuwaf for low memory --- docker/docker-compose.yml | 1 + docker/low-memory-my.cnf | 64 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 docker/low-memory-my.cnf diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index c9bbec6..ab6ce21 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -47,6 +47,7 @@ services: volumes: - wafshared:/docker-entrypoint-initdb.d - wafdata:/var/lib/mysql + - ./low-memory-my.cnf:/etc/mysql/my.cnf environment: - TZ=Asia/Shanghai - INIT_ROCKSDB diff --git a/docker/low-memory-my.cnf b/docker/low-memory-my.cnf new file mode 100644 index 0000000..872a95a --- /dev/null +++ b/docker/low-memory-my.cnf @@ -0,0 +1,64 @@ +# For advice on how to change settings please see +# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html + +[mysqld] +# +# Remove leading # and set to the amount of RAM for the most important data +# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%. +# innodb_buffer_pool_size = 128M +# +# Remove leading # to turn on a very important data integrity option: logging +# changes to the binary log between backups. +# log_bin +# +# Remove leading # to set options mainly useful for reporting servers. +# The server defaults are faster for transactions and fast SELECTs. +# Adjust sizes as needed, experiment to find the optimal values. +# join_buffer_size = 128M +# sort_buffer_size = 2M +# read_rnd_buffer_size = 2M +skip-host-cache +skip-name-resolve +datadir=/var/lib/mysql +socket=/var/lib/mysql/mysql.sock +secure-file-priv=/var/lib/mysql-files +user=mysql + +# Disabling symbolic-links is recommended to prevent assorted security risks +symbolic-links=0 + +log-error=/var/log/mysqld.log +pid-file=/var/run/mysqld/mysqld.pid + + +#### These optimize the memory use of MySQL +#### http://www.tocker.ca/2014/03/10/configuring-mysql-to-use-minimal-memory.html +innodb_buffer_pool_size=5M +innodb_log_buffer_size=256K +query_cache_size=0 +max_connections=10 +key_buffer_size=8 +thread_cache_size=0 +host_cache_size=0 +innodb_ft_cache_size=1600000 +innodb_ft_total_cache_size=32000000 + +# per thread or per operation settings +thread_stack=131072 +sort_buffer_size=32K +read_buffer_size=8200 +read_rnd_buffer_size=8200 +max_heap_table_size=16K +tmp_table_size=1K +bulk_insert_buffer_size=0 +join_buffer_size=128 +net_buffer_length=1K +innodb_sort_buffer_size=64K + +#settings that relate to the binary log (if enabled) +binlog_cache_size=4K +binlog_stmt_cache_size=4K + +#### from https://mariadb.com/de/node/579 +performance_schema = off +