MariaDB Production Configuration
Production server settings for MariaDB, and the places where its defaults and variable names differ from MySQL.
The reasoning in MySQL Production Configuration applies here. This page covers the settings that differ.
[mysqld]
# --- InnoDB ------------------------------------------------------------
innodb_buffer_pool_size = 48G
innodb_log_file_size = 4G # MariaDB keeps log file size, not redo capacity
innodb_log_files_in_group = 2
innodb_flush_method = O_DIRECT
innodb_flush_neighbors = 0
innodb_io_capacity = 4000
innodb_io_capacity_max = 10000
# --- Durability --------------------------------------------------------
innodb_flush_log_at_trx_commit = 1
sync_binlog = 1
# --- Replication -------------------------------------------------------
server_id = 1
log_bin = /var/log/mysql/mariadb-bin
binlog_format = ROW
binlog_row_image = FULL
expire_logs_days = 7 # MariaDB uses days, not seconds
gtid_domain_id = 1 # MariaDB GTID domain; unique per write source
log_slave_updates = ON
# --- Threading ---------------------------------------------------------
thread_handling = pool-of-threads # MariaDB's built-in thread pool
thread_pool_size = 16 # ≈ vCPU count
max_connections = 500
# --- Character set -----------------------------------------------------
character_set_server = utf8mb4
collation_server = utf8mb4_general_ci
# --- Observability -----------------------------------------------------
slow_query_log = 1
long_query_time = 0.5
log_slow_verbosity = query_plan,explain
performance_schema = ON
userstat = 1 # MariaDB per-user/table/index statisticsSettings that differ from MySQL
innodb_log_file_size — MariaDB still sizes the redo log by file size and file count; MySQL
8.0.30 replaced this with innodb_redo_log_capacity. Configuration copied from a MySQL guide will
not apply.
expire_logs_days — MariaDB expresses binlog retention in days. MySQL 8.0 uses
binlog_expire_logs_seconds.
gtid_domain_id — part of MariaDB's GTID format. Each independent write source needs a distinct
domain, which matters in multi-source replication and in Galera.
thread_handling = pool-of-threads — MariaDB includes a thread pool in the community edition.
It helps when connection counts are high and queries are short; with few, long-running queries it
can hurt. Measure before enabling.
userstat = 1 — enables per-user, per-table and per-index statistics, exposed through
information_schema.USER_STATISTICS, TABLE_STATISTICS and INDEX_STATISTICS. There is no direct
MySQL equivalent, and it is a genuinely useful source for finding unused indexes.
Galera
If the server is part of a Galera cluster, several settings become mandatory (binlog_format=ROW,
innodb_autoinc_lock_mode=2, a wsrep_cluster_address) and durability tuning interacts with
cluster behaviour. See Galera Cluster before applying the values
above to a cluster node.
Verifying
SELECT variable_name, global_value
FROM information_schema.system_variables
WHERE variable_name IN ('innodb_buffer_pool_size','thread_handling','gtid_domain_id');