forked from coop-cloud/nextcloud
chore: update MariaDB image and configuration for performance tuning
This commit is contained in:
@ -7,12 +7,14 @@ services:
|
|||||||
- MYSQL_PASSWORD_FILE=/run/secrets/db_password
|
- MYSQL_PASSWORD_FILE=/run/secrets/db_password
|
||||||
|
|
||||||
db:
|
db:
|
||||||
image: "mariadb:10.11"
|
image: "mariadb:11.4"
|
||||||
environment:
|
environment:
|
||||||
- MYSQL_DATABASE=nextcloud
|
- MYSQL_DATABASE=nextcloud
|
||||||
- MYSQL_USER=nextcloud
|
- MYSQL_USER=nextcloud
|
||||||
- MYSQL_PASSWORD_FILE=/run/secrets/db_password
|
- MYSQL_PASSWORD_FILE=/run/secrets/db_password
|
||||||
- MYSQL_ROOT_PASSWORD_FILE=/run/secrets/db_root_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:
|
configs:
|
||||||
- source: my_tune
|
- source: my_tune
|
||||||
target: /etc/mysql/conf.d/my-tune.cnf
|
target: /etc/mysql/conf.d/my-tune.cnf
|
||||||
@ -25,21 +27,21 @@ services:
|
|||||||
- internal
|
- internal
|
||||||
deploy:
|
deploy:
|
||||||
labels:
|
labels:
|
||||||
backupbot.backup: "true"
|
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.pre-hook: 'mariadb-dump --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.volumes.mariadb.path: "backup.sql"
|
||||||
backupbot.backup.path: "/var/lib/mysql/backup.sql"
|
backupbot.restore.post-hook: 'mariadb -u root -p"$$(cat /run/secrets/db_root_password)" nextcloud < /var/lib/mysql/backup.sql'
|
||||||
healthcheck:
|
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
|
interval: 30s
|
||||||
timeout: 10s
|
timeout: 10s
|
||||||
retries: 10
|
retries: 10
|
||||||
start_period: 1m
|
start_period: 1m
|
||||||
|
|
||||||
configs:
|
configs:
|
||||||
my_tune:
|
my_tune:
|
||||||
name: ${STACK_NAME}_my_cnf
|
name: ${STACK_NAME}_my_cnf
|
||||||
file: my-tune.cnf
|
file: my-tune.cnf
|
||||||
|
template_driver: golang
|
||||||
|
|
||||||
secrets:
|
secrets:
|
||||||
db_root_password:
|
db_root_password:
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
# https://mariadb.com/kb/en/library/performance-schema-overview/
|
# https://mariadb.com/kb/en/library/performance-schema-overview/
|
||||||
|
|
||||||
[server]
|
[server]
|
||||||
innodb_buffer_pool_size = 1G
|
innodb_buffer_pool_size = {{ env "INNODB_BUFFER_POOL_SIZE" }}
|
||||||
innodb_flush_log_at_trx_commit = 2
|
innodb_flush_log_at_trx_commit = 2
|
||||||
innodb_log_buffer_size = 32M
|
innodb_log_buffer_size = 32M
|
||||||
innodb_max_dirty_pages_pct = 90
|
innodb_max_dirty_pages_pct = 90
|
||||||
@ -13,7 +13,7 @@ key_buffer_size = 16M
|
|||||||
innodb_log_file_size = 256M
|
innodb_log_file_size = 256M
|
||||||
long_query_time = 1
|
long_query_time = 1
|
||||||
max_allowed_packet = 256M
|
max_allowed_packet = 256M
|
||||||
max_connections = 100
|
max_connections = {{ env "MAX_DB_CONNECTIONS" }}
|
||||||
max_heap_table_size = 64M
|
max_heap_table_size = 64M
|
||||||
max_user_connections = 0
|
max_user_connections = 0
|
||||||
myisam_recover_options = BACKUP
|
myisam_recover_options = BACKUP
|
||||||
|
|||||||
Reference in New Issue
Block a user