chore: update MariaDB image and configuration for performance tuning

This commit is contained in:
Christian Galo
2025-11-02 02:23:59 +00:00
parent d3eff6d963
commit b76d6ba501
2 changed files with 11 additions and 9 deletions

View File

@ -7,12 +7,14 @@ services:
- MYSQL_PASSWORD_FILE=/run/secrets/db_password
db:
image: "mariadb:10.11"
image: "mariadb:11.4"
environment:
- MYSQL_DATABASE=nextcloud
- MYSQL_USER=nextcloud
- MYSQL_PASSWORD_FILE=/run/secrets/db_password
- MYSQL_ROOT_PASSWORD_FILE=/run/secrets/db_root_password
- MAX_DB_CONNECTIONS=${MAX_DB_CONNECTIONS:-100}
- INNODB_BUFFER_POOL_SIZE=${INNODB_BUFFER_POOL_SIZE:-1G}"
configs:
- source: my_tune
target: /etc/mysql/conf.d/my-tune.cnf
@ -25,21 +27,21 @@ services:
- internal
deploy:
labels:
backupbot.backup: "true"
backupbot.backup.pre-hook: 'mysqldump --single-transaction -u root -p"$$(cat /run/secrets/db_root_password)" nextcloud > /var/lib/mysql/backup.sql'
backupbot.backup.post-hook: "rm -rf /var/lib/mysql/backup.sql"
backupbot.backup.path: "/var/lib/mysql/backup.sql"
backupbot.backup: "true"
backupbot.backup.pre-hook: 'mariadb-dump --single-transaction -u root -p"$$(cat /run/secrets/db_root_password)" nextcloud > /var/lib/mysql/backup.sql'
backupbot.backup.volumes.mariadb.path: "backup.sql"
backupbot.restore.post-hook: 'mariadb -u root -p"$$(cat /run/secrets/db_root_password)" nextcloud < /var/lib/mysql/backup.sql'
healthcheck:
test: ["CMD-SHELL", 'mysqladmin -p"$$(cat /run/secrets/db_root_password)" ping']
test: ["CMD-SHELL", 'mariadb-admin -p"$$(cat /run/secrets/db_root_password)" ping']
interval: 30s
timeout: 10s
retries: 10
start_period: 1m
configs:
my_tune:
name: ${STACK_NAME}_my_cnf
file: my-tune.cnf
template_driver: golang
secrets:
db_root_password:

View File

@ -4,7 +4,7 @@
# https://mariadb.com/kb/en/library/performance-schema-overview/
[server]
innodb_buffer_pool_size = 1G
innodb_buffer_pool_size = {{ env "INNODB_BUFFER_POOL_SIZE" }}
innodb_flush_log_at_trx_commit = 2
innodb_log_buffer_size = 32M
innodb_max_dirty_pages_pct = 90
@ -13,7 +13,7 @@ key_buffer_size = 16M
innodb_log_file_size = 256M
long_query_time = 1
max_allowed_packet = 256M
max_connections = 100
max_connections = {{ env "MAX_DB_CONNECTIONS" }}
max_heap_table_size = 64M
max_user_connections = 0
myisam_recover_options = BACKUP