Use MARIADB_USAGE for MariaDB memory budget
This commit is contained in:
+4
-4
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
MARIADB_MEMORY_PERCENT=25
|
||||
MARIADB_USAGE="${MARIADB_USAGE:-25}"
|
||||
MIN_BUFFER_POOL_MB=256
|
||||
MAX_CONNECTIONS_MIN=80
|
||||
MAX_CONNECTIONS_MAX=300
|
||||
@@ -12,7 +12,7 @@ Usage:
|
||||
my-cnf-gen.sh [--output PATH]
|
||||
|
||||
Generates a conservative MariaDB 10.6 my.cnf for DirectAdmin servers.
|
||||
The InnoDB buffer pool is sized to about 25% RAM so other DA services
|
||||
The InnoDB buffer pool is sized from MARIADB_USAGE percent of RAM so other DA services
|
||||
such as web, exim, dovecot, redis and spam filtering keep enough memory.
|
||||
EOF
|
||||
}
|
||||
@@ -87,7 +87,7 @@ calc_buffer_pool_mb() {
|
||||
local mem_mb="$1"
|
||||
local pool_mb
|
||||
|
||||
pool_mb=$((mem_mb * MARIADB_MEMORY_PERCENT / 100))
|
||||
pool_mb=$((mem_mb * MARIADB_USAGE / 100))
|
||||
if (( pool_mb < MIN_BUFFER_POOL_MB )); then
|
||||
pool_mb="$MIN_BUFFER_POOL_MB"
|
||||
fi
|
||||
@@ -152,7 +152,7 @@ generate_config() {
|
||||
# Generated by my-cnf-gen.sh for MariaDB 10.6 and DirectAdmin stack hosts.
|
||||
# Detected RAM: ${mem_mb}M
|
||||
# Detected CPU cores: ${cores}
|
||||
# MariaDB memory budget: ${MARIADB_MEMORY_PERCENT}% RAM
|
||||
# MariaDB memory budget: ${MARIADB_USAGE}% RAM
|
||||
|
||||
[client]
|
||||
port=3306
|
||||
|
||||
Reference in New Issue
Block a user